Gas Cap using an Arduino board

Since you’ve gotten into electronics, haven’t you wondered if there is a fart sensor out there?  I sure did.  I discovered that if you use a methane sensor, especially the MQ-4, even at very low concentrations, it reads farts.  What if you combined that into a hat with an LED Bar Graph and a XBee?  Exactly.  The Gas Cap was made with that in mind.  For around $100, you can build your own Gas Cap, a human gas-operated LED Bar Graph on a hat.  So, you fart into the methane sensor, wirelessly transmit that data to the hat, and watch the LEDs light up so that your friends can see how horrible it was.
Arduino Gas Cap
Feel free to leave any questions or comments.

Step 1: Parts

You will need to purchase the following from Sparkfun:

Relevant Parts:

Methane CNG Sensor  $5
330 Ohm Resistor  $0.25 (2)
XBee Series 2 – Wire Antenna  $26 (2)
Lilypad Arduino 328 Main Board  $22
Lilypad XBee  $15
Lilypad LED PCB Set  $5
Lilypad Simple Power  $5
FTDI Basic  3.3V (for programming the Lilypad) $15
110mAh LiPo  $7
850mAh LiPo  $9
XBee Explorer  $25
XBee Breakout Board  $3
XBee Headers for Breakout Board  $1 (2)
JST 2-pin Through-Hole Connector  $1
SPDT Mini Power Switch  $1.50

Other:

Red LED (10)
Green LED
LiPo Charger Basic  $10
Mini-B USB Cable
A Black Soft Cotton Hat
Altoids Smalls mint tin
PC
Soldering Iron
Dremel
Needle
Conductive Thread  $3
Long Wooden Stick or Umbrella
Hot Glue Gun
Chalk

Step 2: Terminal Configuration

Now it’s time to setup our XBees.  We’ll first load a new firmware on with X-CTU, and then set the parameters with your favorite terminal application.  We need one XBee configured as a Router AT and another for a Coordinator API.  This is because we are sending data from the router, but the only way to receive it is to set it in API mode.
Arduino Gas Cap circuit
Plug your XBee Explorer into your computer with one of the XBees on it already.  Once in X-CTU, select the correct COM port (usually known as “USB Serial Port”) and check the “Enable API” box.  Go into the Modem Configuration tab.  Click the leftmost drop down menu and select XB24-ZB.  Click on the drop down menu to the right of it and select ZigBee Coordinator API.  Click the Always Update Firmware box and then press write.  After about a minute, it should be done uploading the firmware.  Now, take out this XBee and put a “C” on it so that we remember it’s the coordinator.  Put the other XBee in and on the right hand drop down box, select ZigBee Router AT this time.  Go back to the PC Settings tab, and then uncheck the “Enable API” box.  Go back to the Modem Configuration tab, and then press the write button.  After about a minute, it should be done uploading the firmware.  Make sure to mark this one with an “R” so that we remember it’s the router.

Wait!  Stay in X-CTU!  We need to program our coordinator in X-CTU because it is API mode.  Every time you have an XBee in API mode, you have to configure it in X-CTU.  Insert the XBee with a “C” on it.  Check the enable API box in PC settings.  Go back to the terminal and type in “+++” .  Type in “ATRE” to restore the factory defaults.  Type in “ATDH0013A200” to set the high part of the routers serial address.  Type in “ATDL the low part of your router’s serial address” to set the low part of your router’s serial address.  Type in “ATID 0” to set the PAN ID to 0. Type in “ATWR” to write your changes.

Go into your favorite serial terminal application and plug in your XBee Explorer with the XBee labeled with an “R”, or your router.  Type in the following commands after you type in “+++”!

  1. ATDH 0013A200
  2. ATDL the low part of your coordinator’s serial address goes here
  3. ATID 0
  4. ATJN 1
  5. ATD02
  6. ATIR 64
  7. ATWR

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]
Methane CNG Sensor  $5
330 Ohm Resistor  $0.25 (2)
XBee Series 2 – Wire Antenna  $26 (2)
Lilypad Arduino 328 Main Board  $22
Lilypad XBee  $15
Lilypad LED PCB Set  $5
Lilypad Simple Power  $5
FTDI Basic  3.3V (for programming the Lilypad) $15
110mAh LiPo  $7
850mAh LiPo  $9
XBee Explorer  $25
XBee Breakout Board  $3
XBee Headers for Breakout Board  $1 (2)
JST 2-pin Through-Hole Connector  $1
SPDT Mini Power Switch  $1.50[/box]

 

For more detail: Gas Cap using an Arduino board


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top