Saturday, 15 February 2014

Ghetto Real-time Carbon Monoxide Data Logger

*This article is of course the ramblings of a hobbyist and not to be taken as fact. You do these things at your own free will. Free will is a great thing mind you…
Something a little different. I feel I have been concentrating too much on my ghetto fpv quadcopter development, and need to do something a little bit different for a while. I have a multifuel/woodburning stove in my house and I’m very happy with it. It’s a huge Morso stove like this one:
5
It was bought new, and was fitted professionally, and it works flawlessly. For this privilege, it set me back several thousand pounds. I don’t need to worry if the stove is damaged, old, worn, or if the flue pipe is leaking, and various other possible scary possibilities.
Anyway, a friend of mine earlier this year, decided they too would like a wood burning stove for their house. My friend is well travelled, and has lived in some strange places, and tiny remote villages. It is fair to say that he lives a somewhat alternate lifestyle now, and believes in political conspiracy, and corporate state control. To him, everything is a lie :)

4
So, he decided he was going to build a woodburning stove. He bought a second-hand stove on ebay for just over £150 pounds (it’s an old 4kw stovax brunel 1a – rrp £1250). The stove looks old, worn, and needs a new baffle plate & fire bricks.
Anyway, he bought a chimney flue kit and smashed in his chimney to build his own fireplace, scaled his own roof, cleaned the chimney, and fitted the flue himself. Amazing! I thought. But mad. His stove cost him a total of about £600 to buy, fit the flue, and do the building work on the chimney. Mine cost me about £5000.
We talked about the legalities about building your own stove, and it seems, as long as you follow some general guidelines, you can indeed build your own stove without relying on a company to do it for you. No matter if a Gas company comes knocking at your door telling you otherwise (It is suggested by my friend, that it is in the interests of British Gas to try to prevent you from building a stove, and seeking out any problem they can to enable them to stop you, so you have to rely on using gas). But my friend has been out in the woods too long perhaps?
Anyway, he wasn’t completely irresponsible it seems, as he bought a couple of carbon monoxide alarms and fitted one on each floor of his house. 2
      3Which led us to an idea….
We looked at these alarms, and read their instructions. It seems that what they do, is detect certain carbon monoxide levels, for certain durations. They are more of a ‘life saving’ device, than a device used for data monitoring.  It seems that health & safety guidelines suggest that you should not be exposed to carbon monoxide for durations explained below:
1





















It seems that according to the alarms he bought, the instructions suggest that the alarm will trigger if exposed to a minimum of 30ppm of Carbon Monoxide for a period of 8-hours. So, you have to wait 8-hours for the alarm to even trigger for a low level. The alarms will only trigger immediately if levels of over 4000ppm are detected.

This worried my friend and me a little bit. What we were concerned with, was low-level poisoning and it’s effects. It seems low-level poisoning can damage brain function and repair, effectively contributing to a certain level of brain damage that might be not too dissimilar to excessive alcoholism and brain damage. This is what we concluded, after several strong pints of ale and some discussion.
What we wondered was how we could read low level ppm in real-time? Like on a graph?

The alarms he bought; one has an LCD display that, when the test button is pressed, will display the ppm reading. You also get a quick short blast of the alarm too, just for good measure. It seems that pressing the button every minute to record a ppm reading (with the added alarm sound blasting your ear) is a bit impractical. What we need is a device that can record ppm and log it every few seconds.
So, me, with my electronic skills, suggested I build something that does exactly that.

It seems, that in the Arduino prototyping platform, there is a range of common gas detecting sensors available which record anything from Methane (parp) & carbon dioxide; to smoke & carbon monoxide. These sensors come under the range of MQ(X) sensors. The X being a number 1-9 to the according sensor. You can read about them here.
They are available on ebay for a couple of quid. 1234
The MQ7 sensor that reads carbon monoxide in the range of 10-10000ppm can be connected to Arduino using only three of it’s four pins.
We can then write a program to read the sensor every, say 5 seconds and give us a ppm reading. Enough of these readings, and we can plot a graph to show how well the stove is working, if there is any damage to the stove, if there are any leaks, if someone opens a house door, if the fire is raging, or dying down. All these factors should affect low-level carbon monoxide readings in some way.

So, if we connected the MQ7 sensor to the Arduino Uno like in this diagram:
sensor-mq7-diagram

Then we upload this sketch to it >>>>> This Sketch
The sensor will print out ppm data every 5 seconds.
The code works like this:The sensor it seems, needs to heat up for at least three minutes to allow it to read data properly, so the sketch begins with the following text displayed in Serial Monitor: “Sensor Heating…” for 3 minutes until the sensor is hot enough. The Arduino then makes an initial sensor reading. This initial sensor reading is made at neutral ‘carbon monoxide free’ area – i.e. outside in the open air, or similar place. The arduino then makes another reading after 5 seconds have passed, then another after a further 5 seconds, and so on.
The arduino makes a calculation:
ppm reading = (5-second Sensor reading - Initial sensor reading) + 5
The ‘5’ value is used because it is assumed that a normal house will have a natural ppm reading of 2-5ppm.
It is also assumed that a house with a woodburning stove in it, will have a normal ppm reading of 7-15ppm depending on the type of stove, fuel burning used, ventilation etc.
Once we have the arduino set up and recording data, we can open the Serial Monitor and log data until we are happy:
22222
As you can see, in my office, the readings are a normal 5ppm on average. When my wood stove is on, the readings increased to between 7-10ppm.





I decided to take the arduino round to my friends house to sample some data:
666666
My friends stove readings were recorded over a 4-hour period. The readings went up to a high of 18ppm, and a low of 4ppm. During this period, doors were closed and opened – affecting projected room heat, and ventilation. When the door to the kitchen was opened, the reading would drop as there is a wall vent installed there.
The stove ppm would increase when the wood was burning fiercely, and the ppm reading would decrease as the fire died down to ashes -As you can see at the end of the data.
All very interesting!
In the future, I am going to repeat the sensor data recording, and use readings from the monoxide alarm that has an LCD as a comparison.
Also, in the future, I will blog a tutorial that will record the sensor data remotely over wireless Ethernet, and I will be able to view the graph in real-time using a web browser. Now this is an exciting idea.
In the mean time, feel free to have a play with the existing code, and try your own calibration experiments.

Listen to this too:


Data Logging Information:
The setup above is simple. You simply run the sketch, open Serial Monitor on your computer, collect the data, ctrl + A to select all data, ctrl + C to copy, then paste it into excel or wherever.

Saving the data to a file.
If you have a serial terminal program like CoolTerm on your computer, you can also capture to a file. To do so, open CoolTerm, and choose your serial port in the Options menu. Click the Connect icon, then from the Connection Menu, choose Capture to TextFile… and Start. Give your file a name and save.
Note: if you want the file to start from the beginning of your sketch, hold down the reset until you’ve started capture.
To stop capture, choose Connect > Capture to TextFile… > Stop. Then you can use your file in any application you want. Change the file extension to .csv and you can open it in a spreadsheet and graph as above.
Saving Data to a micro SD Card.
Sometimes you want to save data when you’re not connected to a personal computer. Attaching a micro SD card to an Arduino is fairly straightforward. There are several different shields that have SD cards on board, and the Arduino Ethernet has a micro SD card on the board. The SD card library makes it simple to save files to the SD card.

Insert a freshly formatted micro sd card into your Arduino Ethernet Shield. Attach the Ethernet Shield to the Arduino Uno, connect the MQ7 sensor to the three pins (5v, GND, A0), then upload the MQ7_SDCardDataLogger sketch. This sketch reads the MQ7 sensor, and if there is an SD card present and initialized, it saves the results to a file called “DATALOG.CSV”. Transfer this file to your computer and use it as you wish. You can open it in a spreadsheet and graph it as you did above, or anything else you wish. If you just want the raw data, and no text ("ppm" "sensor heating" etc) use this file. It will take a sensor reading from the moment the logger is switched on, every 1 second, which will show how as the sensor heats up, the value quickly drops then levels out:

You can use this to make your own calibration ideas, to obtain 'true' ppm values. 

Adding an LCD display & RTC Clock to this would pretty much make a complete device. Maybe I'll update this in the near future.
Saving Data online to Plotly.
If you have an Arduino ethernet shield, you can upload your data directly to Plotly in real-time. You may have heard buzzwords such as 'The Internet of Things' or 'Big Data' recently, and this is one example of this quest for finding new data about our lives. Anyway, Plotly will save your data, and allow you to make and format a graph style so that any data will be loaded into it automatically. It will even record the time that the reading was made (very handy to know without carrying a stopwatch or using a real-time-clock in your circuit). My tutorial is coming soon, but in the while we wait have a look at this tutorial so you can get to grips with using Plotly.
You can also extend the use of the Ethernet Shield with Plotly, by making it wireless. Devices like the TP-Link TL-WR702N, and this other even cheaper ebay device, can be set up as a wifi repeater, and it's Ethernet port connected directly to the Arduino. It makes this a very cheap wireless solution to send data to Plotly (considering the price of the official arduino wifi shield £80?!). You can even wirelessly tether the cheap ebay router with a mobile phone and use the 3g/4g signal, meaning you aren't even limited to house wifi connections. There are also some low-cost mini pocket routers which also connect with 3g usb dongles. There's some really neat possibilities for sensor-based data gathering. Want to collect emissions data on your local road? Or perhaps logging potential local fracking emissions? Have fun and if you think this is cool:

Tuesday, 14 January 2014

FPV Video

Thursday, 2 January 2014

Micro OSD

BenbojanglesOSD

So, I decided to build a micro-osd for my micro fpv quadcopter. It's still in progress, but if you are interested in this project and would like to add you inputs then please visit this page: http://benbojanglesosd.blogspot.co.uk/


Friday, 6 September 2013

Ghetto fpv Goggles

Ok so for the first time, this isn't one of my own posts. However, it is possible to make your own ghetto fpv goggles to enable you to have a more immersive flying experience, and also look like a dimwit at the same time ;)

Here's the guide: http://youtu.be/2H_PvU82o7A


And if you're happy to buy a cheap kit version. Look here: http://www.flyingwings.co.uk/index.php?route=product/product&path=57_76&product_id=382


:) :) :)


Thursday, 29 August 2013

Ghetto fpv quadcopter: episode 2



Ok, so in my previous blog post, I wrote a fairly comprehensive instruction on how to build a ghetto fpv quadcopter for around £115. It works well. However, just this week I was given a camera module MC495a

I decided to test it and see how it works. 
Connecting the mc495a to our 200mw tx is fairly straight forward. Desolder the simple usb wire from the tx's video out, snip off the connector attached to the rca a/v adapter cable included with the camera, and solder that on to each of the 4 connections on the tx - video, audio, power, ground. Not forgetting the diode at the power. Done. Now, you just plug the camera into that new 4-pin connector. I sealed the exposed back of the camera using tape.


mounting the camera and tx I tried a different approach than the top-mounted 808 #16 camera, as I have thought about the damage to the cloverleaf antenna I have had to repair often, using this method. I opted for a tail-like antenna mounted out the rear of the quadcopter using a simple 'bag-pouch' made from anti-static plastic bag material and a small ziptie. The front, I screw mounted the camera to the front of the quad frame (the screw was a silver screw from the case of the 808 #16 camera).
Simples...

Using an rca-to-3.5mm plug pigtail cable, connected to the rca audio plugs on the rc305 output, I am able to get audio aswell as video on my controller, using a cheap speaker: like this.

I like the camera, as it is lighter and seems more robust than an uncased 808 #16 camera. It seems like the picture quality, and response time is better too.

Downside is that it isn't recording 720p vdeo to sd card. However they can be swopped over if needed, or I may try a WLtoys v262 in the future, of something that can lift both fpv setup & 808 #16 cam (possibly with a cheap gimbal rig...watch this space)

I am recording this fpv camera using a cheap easycap dongle on a laptop, using virtualdub software. Works for me.

One problem I am having, is that I have learned to fly fpv by aiming to have on my monitor screen, half sky, half ground. And as such, as the sky is often naturally brighter than the ground, the camera adjusts for light, and makes the ground dark, shadowy, almost un-viewable. As the camera doesn't seem to have any way to adjust light exposure control, I am wondering what your solutions are?

I am thinking:
-Learn to fly with the camera pointing 90-100% ground, when level flying. (Could be risky monitoring level flight)
-stick some kind of graduated filter over the lens, so that the sky is dimmed, causing the ground to be lightened. I'm aware of photography-related graduated filters, but not tiny lens graduated filters. Anyone have experience with this idea?

How do you adjust/mount your fpv camera to get the best light exposure setting?????











Saturday, 27 July 2013

Ghetto fpv Quadcopter

Ok, so in my last post, I wrote about making a video recording quadcopter using an 808 #16 keychain camera and a cheap toy quadcopter, the WLtoys v929. Quadcopter recording is great. I have had many adventures recording at places ranging from my local woods, to Donnington Race track in the UK.

Anyway, my point being, once I had the flying bug, that is, once I learned not to crash anymore, I wanted to hack what I had, more. I learned that the 808 #16 camera allows video-out through it's usb port, and by mashing together a simple transmitter and receiver I could send and receive video to a screen. So, in effect I could fly FPV (first person view). It works great and I feel like I have experienced what it is like to fly, and learn-to-fly an aircraft. It's a strange feeling flying something that is out of sight, and it takes calm nerves and trust of your gadget creation skills. Things you need to know are, the quadcopter and controller use the 2.4ghz radio band which is the same as wifi. This means, parts are readily available and cheap. The video uses 5.8ghz radio band. The two bands are not the same as each other to help prevent cross frequency interference. Long-range radio frequencies are lower frequencies, i.e 1.3ghz, 900mhz. However, we will be using less expensive, higher frequency gear, and improve them with better antennas. We have a limited weight allowance with which to load the quadcopter before it becomes unable to take off, so we have to be very lean with materials. I estimate the lift allowance to be around 25-27grammes. What you will have at the end of this project is an fpv-ready quadcopter that will have greater range than the 'cheap' sub £250 quadcopters, and with better video quality, HD recording, cheap replaceable parts if broken, and modular parts that can be used on other gear (planes, cars, bird nest monitoring, etc). I figure that getting an fpv quadcopter, including controller, batteries and go-pro camera will cost about a grand. Ours will cost about a hundred pounds.



So here's a run down on the parts:

-I use a cheap 7" monitor from ebay that works great = £12
-3S 11.1v 3800mah lipo to power the monitor (secondhand but pristine condition = £6). Although the 2s 1300mah lipo powered the monitor perfectly fine for an hour as I timed it. So the 3800mah 3s is plenty.
- RC305 RX again from ebay = £15
- 2s 7.2v 1300mah lipo for the RC305 = £5
- Both of these have been attached to the back of the monitor using velcro sticky strip (£1 per metre)
- I trimmed all cables as short as I wished on the monitor, and the RC305 cable lost it's 2 audio cables, leaving only video.
- Camera 808 #16 wide angle from ebay = £28

- hacked up an old mini usb cable to get the plug and used only pin 2. I used this for video out instead of trying to solder a single wire to the camera board pin 2. As this seemed too fiddly at present. And I want to use the 808 camera as bike mount and hat mount cam, so I wish not to butcher it.
- TX5823 200mw 5.8ghx module from ebay = £15

- Tx uses a N4001 diode to reduce the 3.7-4.2v of the lipo, to 3.3v that the TX requires - preventing it from burning out.
- RG316 pigtail with RPSMA connectors. Hacked this up to make an antenna, soldered outer shield cable to ground, centre cable to antenna. Have enough left over for several cloverleaf/helical antennas in future. = £2
- Using tiny 3.7v 1s lipo that I use for both the 808 camera & Tx. ebay = 3pack £2.50
- the tx, lipo, 808 all use a combination of micro jst connectors that I bought (male & female 10xpack) on ebay for £1.50 - not the normal red jst connectors. I want to use this at present so I can easily change the lipo if it runs out, and use the tx module on another RC vehicle, or use a cheap 520tvl camera later on if I wish.
There has been lots of trimming & soldering wires as short as they can go, trimming and soldering coaxial is a chore.
Battery charging - I'm using the v929 1s charger for the 1s lipo, and cheap B3 balance charger for 2s & 3s Lipos (ebay £4)

Price rundown (What I paid):

monitor = £12
3s lipo = £6
2s lipo = £5
RC305 Rx = £15
Velcro strip = £1
808 #16 camera = £28
TX5823 = £15
5x N4001 diodes = £1
RG316 pigtail = £2
1s 3.7v lipo x3 = £2.50
micro jst connectors = £1.50
Balance charger = £4
V929 quadcopter & 2.4ghz controller = £26
Total = £119



Early build stages:


setting up the transmitter, soldering & glueing the transmitter, building a tiny antenna...


Early mounting idea (note transmitter has not got the finished antenna yet)


Added a Diode to reduce the battery voltage slightly to prevent the transmitter from burning out.

Built a tiny circularly-polarized antenna for the transmitter, which enables 360 degree coverage, and much less static & dropout. I used this wire.

figured out the best way to mount the monitor to the controller as best as I could. I used some old single-ply wood from the shed, and cut it up. Nothing too fancy, wanted to keep it ghetto. Used some old foam board as a sunlight hood - attached with velcro.

Painted the monitor hood black, and sealed out any light from creeping in and affecting image quality using black vinyl tape. Damn sunlight...

I tested the video range using the scientific method of placing the quadcopter on a tree stump and walking as far as I could with the monitor/controller, before the video picture signal dropped out. I managed fairly well on first try. Better to know the limits before launching :)

Eventually, after several cheaply repaired crashes, I learned to fly using only the monitor, which is a weird feeling, and can cause panic at first. This was my practice loop which I have now mastered, and I'm flying over trees and buildings without worrying too much...

I eventually taught myself to build a helical antenna using the base of a pringles can, some copper wire, a piece of scrap/leftover plywood, and some solder and hotglue. Range almost doubled. I am guessing, but I think I get about 600m radius. Might have to walk the range test again....

I added some push switches, as I was finding it stresssful to get setup by fiddling with wires and plugs, and then attempting to take off. It worked, because I lowered my stress levels resulting in fewer crashes, and I was able to manage listening to my girlfriend calling me a loser and to get a life while flying. heheh.

I hacked open the cheap controller, and desoldered the crappy antenna inside there. I added RG316 cable with an already soldered plug on the end. This allowed me to use a more powerful antenna.

Like this black rectangular wifi antenna. 

So, now I am happy that I am actually flying. I can improve the quadcopter handling by swapping the 808 #16 camera with a small security-style spy camera module which uses 3.7v weighing 2grammes. This can reduce weight load by a massive 15grammes, allowing a slightly larger transmitter battery to be used, or possibly an OSD module like below.

I am also aware that WlToys have released a more 'balanced' quadcopter called the v212. Which, has an accelerometer as well as the gyroscope to assist in levelling during flight, preventing wind from blowing it over, and correcting errors. I even hear you can throw it in the air and it will correct itself ready to fly. Also, this week WlToys have released the v262, a larger quadcopter that seems to allow up to 100grammes of lift. This would allow you to use a mini fpv camera that we made with the 2gram camera, and also the 808 #16 camera to record video, from different angles such as, from the rear of the quad. That might leave more weight allowance for experiments with a mini servo gimbal rig for the 808 camera.

Progression on this project could be to hack the quadcopter circuit board, and add a digital compass and barometer like they have in mobile phones running 3.7v. This could mean you can then measure altitude and direction, and possible make a switch to hold altitude, and set heading.

Once the above has been achieved,you could also integrate a small 3.7v OSD (onscreen display):

Which could show you flight time/voltage left, altitude, gyroscopic yaw, compass measurements etc..

Another possibility, could be to attach a RaspberryPi tiny computer to the back of the monitor, and program an Augmented Reality game that could blast aliens, shoot balloons, or fly through rings. 

Now wouldn't that be fun?

And you will have made it all yourself :)

Thanks and feel free to donate a dollar:











Wednesday, 27 March 2013

Ghetto Video Quadcopter

Ok, So we have quadcopters. I did a lot of research into getting one, and my first avenue was the Mikrocopter, kkmulticopter, multiwii controller board to enable me to build my own. It turned out that this direction could add up to about £550 for the transmitter, frame, esc controllers, motors, props, control board, lipos & charger, and fpv. Nuh-uh. I say. £550 is a significant figure. And that's even without gps/dji systems & a gopro camera. And considering the amount of bad, wet & windy weather I get around here, It could be a disaster.


So, I put it off for a few weeks, and came back to it at a later date. What interested me now was the Hubsan Spyhawk plane with fpv camera. I really like the swooping and gliding to be had with planes as opposed to quadcopters. £200 seemed a good bet to me, and I was hoping to eventually take the fpv system from the spyhawk and add it to a quadcopter at a later date. Alas this seemed complicated.

Eventually, I looked at the mini quadcopters that are around; like the Hubsan X4, and wondered if they had the required lift to carry a camera like a gopro. I know that was a physical impossibility, so I looked at other options. What I discovered was the WLToys V929 ladybird quadcopter.

And the 808 #16 120 degree keychain spy camera:


It seems the v929 had the lift to carry this camera! Whooo! And the price - Quad = £26 Camera = £28 Total = £54

So I ordered it, and stuck the two together. And this is what I got.....

 

In the future, I will add a teeny tiny fpv system using these parts: camera, receiver, monitor, transmitter. But for now I am learning to fly it. It is not easy. And wind is a quad killer. I really like the 808 camera for what it is. It offers the same wide view as high end action cameras, is good quality, and cheap. I like that I can just carry it in my pocket and forget about it (it has a lens cap), mount it to my bike, hat, quadcopter, even make a waterproof case and take it underwater. I work at music festivals during the summer, and I think I might try to sneak my mini quadcopter into the festivals and film from above. It's small enough, and I might even mod it to have a collapsible frame so it's even smaller. It could make some amazing filming. :)



What I notice, no matter what, is that all good quadcopter videos are all captured during perfect weather! So, even if you are witnessing the birth of the second coming, if it is blowing outside, it's tough titty.