element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog Carbon Footprint Monitoring - Emission Sensor Firmware
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: xever
  • Date Created: 6 Dec 2014 7:00 AM Date Created
  • Views 782 views
  • Likes 1 like
  • Comments 0 comments
  • iot_footprint
  • in_the_air
Related
Recommended

Carbon Footprint Monitoring - Emission Sensor Firmware

xever
xever
6 Dec 2014

This week's update is going to be short but sweet, as I have been working most on the firmware architecture and device driver development.  So far, the code flow as below.

 

image

 

 

The intention is that the emission sensor board will be powered by the car's battery via 12V plug, ideally this will be wired through the ignition switch, so we can detect that the ignition is turned on or off.  However, for a minimal design, we can determine the engine state through a vibration profile.

 

After the hardware has been initialised, the main loop for the firmware will sample the accelerometer at TBD rate.  More research needs to be done on identifying the ideal sampling frequency, and vibration profile at different engine states.  The sampled value is then stored to a buffer and filter out the noise.  Again, as with the sampling frequency, the filter type and coefficients are yet to be determined, more of info will be provided in the coming posts about signal processing.  At this stage, data acquisition is the more important part.

 

From the filtered data we will be able to deduce the engine state, i.e. off, idling, or running and send the updated state to a connected smartphone via Bluetooth LE.  If the engine is running, CO2 emission is sampled and sent to a smartphone for further processing.   CO2 emission, engine state and GPS data (as read from smartphone) will all be used to generate tangible information before being sent to AirVantage.


Translating the flowchart into code, we have the following (excerpt from main.c):

int main(void)
{
   Acceleration_T raw_accel;
   Acceleration_T filtered_accel;
   EngineState_t engineState = Engine_Off;

   Hardware_Init();

   while (1)
   {
      if (Accelerometer_IsSamplingCompleted() == false)
         continue;

      Accelerometer_GetRawAcceleration(&raw_accel);
      FilterNoise(raw_accel, &filtered_accel);

      if (EngineStateChanged(filtered_accel, &engineState))
      {
         SendEngineState(&engineState);
      }

      if (engineState != Engine_Off)
      {
         /* Sample CO2 emission */
         int32_t temperature = 0;
         int32_t humidity = 0;
         HDC1000_Measure(&HDC1000_Instance, &temperature, &humidity);
         MQ135_Read(&MQ135_Instance, temperature, humidity);
         SendEmissionInfo(&MQ135_Instance.ppm);
      }
   }
}

 

Since time is ticking so fast, and I have a good working firmware framework in place, so I think its about time for me to switch my tasks and focus on hardware development.

Attachments:
main.c.zip
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube