OSWIN with ethernet and RFM12B and XRF radios
OSWIN is the only slightly contrived acronym for my new Arduino compatible Open Source Wireless IoT Node based on the ATmega1284P AVR microcontroller.
I blogged about using the ATmega1284P with the WIZ820io ethernet module last year and was subsequently sent two prototypes based on the same combo to evaluate, the MAX1284 and the Air Sensor Hub. For the last 6 months I’ve been running the MAX1284 prototype as a replacement for my Nanode emoncms gateway, uploading data from my TinyTX sensors to my emoncms installation and it has been rock solid. Inspired by this and with another $10 Seeed Studio PCB voucher burning a hole in my pocket I decided what the world needed was yet another open source Arduino compatible.
If nothing else this will now allow me to point people asking what I am currently using on the receiving end of the TinyTX sensors towards something they can duplicate for themselves and as it has all the standard Arduino features and more it can also be used as an “Arduino on steroids”. The extra resources will certainly come in handy in many projects, including use with some of the RAM heavy GLCD displays and it would help with the RAM problems I ran into with my Nanode based IR web remote control. As well as being Arduino shield compatible and having options for the RFM12B transceiver and ethernet module there is also an Xbee compatible socket allowing use of Xbee or Ciseco XRF radios or a wi-fi version can be created by fitting a Roving Networks RN-XV.
Continue reading Introducing OSWIN, the Open Source Wireless IoT Node
TinyTX3 fitted with a DS18B20 temperature sensor
Since I put the files for the first PCB version of my TinyTX wireless sensor node online in June I’ve heard from people around the world who have had their own boards made which is really encouraging, especially as it was my first PCB design and was mainly done just to learn how to use the Eagle CAD design package (I wish I’d seen these great tutorial videos when I started, it would have saved a lot of time). There is obviously a big demand for this sort of thing.
Like the earlier stripboard versions the first PCB version was designed purely for use with the DS18B20 temperature sensor but if you’ve been following the TinyTX progress you will know that I’ve since found lots of other uses for it. Having only 2 of the ATtiny I/O pins being available was starting to become limiting though so I wanted to do a respin with additional pads for some of the unused I/O pins and I also took the opportunity to fix the tight clearance between the power connections and the RFM12B, improve some of the layout and add spaces for decoupling capacitors on the ATtiny and RFM12B, I’ve not had any problems without them on the previous version or on the original stripboard design but it is good practice to have them so we might as well have the option of fitting them if required.
The biggest change is at the top where I’ve added space for 6 I/O pins plus ground and Vcc (Row 1) and instead of a fixed space for a pull up resistor I’ve added two rows of standard 2.54mm spaced holes, one row (Row 2) connected to the header row and one unconnected row (Row 3) which will allow for many more configurations. The IO pins are labelled with the equivalent of the Arduino digital pins as used in arduino-tiny, it looks a little odd as the numbers aren’t consecutive but I didn’t think it made sense to do it any other way. Continue reading TinyTX3 Wireless Sensor Board
The sensor egg
Way back in March 2012 I backed my first Kickstarter project, the Air Quality Egg from Wicked Device, a project to build a community-led air quality sensing network. It has been a long time coming but despite Royal Mail’s best efforts it has finally arrived.
From the Air Quality Egg website: “A community-led air quality sensing network that gives people a way to participate in the conversation about air quality. The Air Quality Egg is a sensor system designed to allow anyone to collect very high resolution readings of NO2 and CO concentrations outside of their home. These two gases are the most indicative elements related to urban air pollution that are sense-able by inexpensive, DIY sensors.”
The kit comes as two identical looking ‘eggs’, one goes outside and contains the sensors for NO2 (nitrogen dioxide) and CO (carbon monoxide) as well as temperature and humidity, the other is the base station that plugs into your network or router to connect to the internet. The main boards inside both eggs are SMT variations of our old friend the Nanode with the sensor unit also containing a custom designed shield containing the sensors along with sockets that allow additional sensors such as a dust sensor to be added. Once set up the base station relays the data from the various sensors to a customised version of the cosm.com platform at airqualityegg.com
The project came in for some criticism for being late to deliver (not at all unusual on Kickstarter), it was originally estimated for delivery in July 2012 and the kits didn’t actually start shipping until January 2013 and communication along the way wasn’t as good as it could have been, with irregular updates often spread across several sources. It did get a bit better towards the end though and the important thing is that they got there in the end, something that can’t be said of all Kickstarter projects.
So what’s it like? Continue reading Air Quality Egg – Community air quality monitoring
Note to self, don’t put silkscreen text over vias you plonker!
I’m still waiting for the PCBs for the latest revision of my TinyTX board to arrive but these breakout boards for the RFM12B transceiver which I actually ordered on the same day ended up getting sent a few days ahead of it for some reason, maybe it is because I went for a red solder mask for the TinyTX3.
The RFM12B is the radio module I use in the TinyTX, it’s also used in JeeNodes, OpenEnergyMonitor, Nanode, WiNode and the Air Quality Egg to name a few, it’s a very handy little board but it’s a pain to use on a breadboard or with stripboard, I decided I’d had enough of soldering little bits of wire to them so I thought I would get some proper breakout boards made.
Continue reading RFM12B Breakout Board
The guys at OpenEnergyMonitor were kind enough to send me a prototype of their new RFM12Pi board a few weeks ago, this handy little kit allows our favourite low power radio board to be connected to the immensely popular Raspberry Pi. This makes setting up a tiny little server for receiving data from the OEM emonTX or my own TinyTX sensor boards very easy and negates the need for a separate internet gateway device such as a NanodeRF. If you want a local back end solution rather than a remote server it’s ideal.
While everyone else was struggling with interrupt issues when trying to get the RFM12B to work directly with the Pi, Martin went instead for the simple method of using an ATtiny84 to receive the data from the RF module and then spit it out to the Pi’s UART. A PHP script on the Pi then receives this, correctly formats it and sends it on to emoncms. Simple but effective and allows the tried and tested JeeLib RF12 library to be used on the ATtiny.
The board comes as a kit which shouldn’t take more than 10 minutes to put together and then just plugs onto the GPIO headers of the Raspberry Pi. Assuming you already have the Raspbian Linux distro installed on your Pi all you need to do is install emoncms (+ Apache, PHP and MySQL if not already installed), the PECL PHP serial module and the Raspberry Pi emoncms Module and you will be receiving data from your nodes in no time. Follow the complete setup instructions here.
Continue reading Using Raspberry Pi as a base station for TinyTX
Here’s a cheap way to build your own fully customisable infrared PC remote control. If you already have a suitable infrared remote control going spare you can build one of these for under £4, it will allow you to use most infrared remote controls to issue keyboard commands (single characters or a string) on your PC. Using a surplus remote control it could be used as a cheap media centre remote control with XBMC etc. or would be great for causing some mischief by covertly taking control of someone’s computer. I’ve tested it on several Linux and Windows boxes and one Mac and it has worked fine on them all so far.
At the heart is an 8 pin ATtiny85 microcontroller running at 16MHz using the internal oscillator with a Vishay TSOP31238 IR sensor handling the IR reception and USB implemented with V-USB. Each remote control button can trigger a single keyboard character or series if characters as well as meta keys such as shift and alt.
I couldn’t find any guides for using V-USB on the ATtiny85 under the Arduino environment so have detailed what I did in full here. Other than changing the default PIND, pin and timer settings the key seems to be that when using the internal oscillator like I am here it needs to be calibrated for each individual chip as the timing for USB is so critical.
Continue reading TinyPCRemote – An ATtiny85 Based Infrared PC remote control
As I’ve been adding more and more TinyTX wireless sensors one thing that was bothering me was the lack of ACK support in the system meant that if the base station was busy receiving a packet from one node then anything sent from another node at the same time would be lost. By adding a method for the base station to send an acknowledgement (or ACK) that the data has been received it would allow the transmitter to wait a while and try again if the ACK isn’t received.
Turns out this is pretty easy with the Jeelib RF12 library and I’ve added code to the all the TX examples and the emoncms base station examples. By default after transmitting the data packet the TinyTX waits 10ms for an acknowledgement of receipt from the base station, if one isn’t received in that time it waits 5 seconds (with the processor and radio in sleep mode) and then tries again up to a maximum of 5 times. All the timings are configurable in the #define statements near the beginning of the code.
The image is showing node 17 getting sent an ACK on receipt of the data, the other nodes aren’t running the updated code yet, I need to go round and update them all.
As always the latest code is available on the TinyTX page or on Github.
I’ve also converted the Nanode RF base station code for relaying multiple transmitters to emoncms to work on the ATmega1284P and WIZ820io (on Github here) and added code to get the time from an NTP server and transmit it for use with my graphical LCD displays. I’m running this on the prototype MAX1284 PCB I was sent and it is working very well and shows some great potential for expansion in the future.
I covered some of this in the comments on my last post but thought it made sense to do a separate post detailing it.
The DHT22, also known as the AM2302 and RHT03 is a relatively cheap combined digital temperature and humidity sensor that with a little manipulation will go straight onto my TinyTX sensor board (or previous stripboard versions) in place of the DS18B20 temperature sensor.
The DHT22 is widely available and costs around £6 on eBay with delivery so not too expensive, don’t be tempted by the cheaper DHT11, in my tests the readings it returned were wildly inaccurate and it will only return integer values and only covers 0-50°C compared to -40 to 125°C for the DHT22. Someone also commented in the previous post that they had the same experience of inaccurate results with the DHT11 so it seems it wasn’t just a one off bad unit that I had.
The DHT22 has four pins but the third (looking at it face on) isn’t used, by bending the unused pin out of the way and bending the fourth in slightly it will fit into the pads for the DS18B20, the only other change required for the hardware is to swap the 4K7 resistor for a 10K. Load the ATtiny with some modified code and we’re good to go.
The gotcha here is that the DHT22 only works down to around 3V, once it dropped below 2.96V in my tests it started to return bad readings. For the moment I am just running one off 2xAA batteries (a starting voltage of 3.19V) and will see how long I can get from it. My ATmega based temperature sensor took 6 months before the voltage dropped to 3V so I should get at least that long and I could then recycle the batteries in one of my DS18B20 sensors. Failing that I could use a boost converter to keep the voltage up at 3.3V or add another battery or two and use a voltage regulator to drop it to 3.3V.
The code for using the DHT22 sensor is available on my GitHub here. The sensor uses a one wire type protocol but is incompatible with the Dallas OneWire system, I’m using the library from here although thanks to a comment from Troels in my last post I realised it has a bug regarding negative temperatures, I’ve fixed that and submitted a pull request but in the meantime you can use my fork here.
I’ve also been looking at other humidity sensors, the Sensirion SHT1x and SHT7x look good, work down to 2.4V and are easily available but they are pricey (~£20+), the HYT131 is a bit cheaper (~£15+) but not widely available. All these use a 2 wire bus to communicate so wouldn’t be as easy to use with this board as the DHT22. Probably something to look at closer for the next version of the TinyTX.
There is now a dedicated page for the TinyTX.
For the latest iteration of my wireless temperature sensor (compatible with OpenEnergyMonitor, Nanodes and Jeenodes) I decided it was time for a proper PCB. While it’s not too much hassle to make one from stripboard, botching the RFM12B transceivers onto it is a bit of a pain in the bum and a custom PCB makes it a lot smaller, neater and quicker to build overall. I had made some PCBs a very long time ago using ferric chloride etching and the letraset style transfers but found it to be hard work with very variable results and not something I cared to repeat, newer laser printer transfer techniques look like they can make things a little easier but getting short runs of professionally manufactured boards produced is also a lot easier and cheaper these days so I thought I’d try my hand at that.
So a couple of weeks ago I got stuck in and designed a board with the Eagle CAD software. I’d played around with Eagle a bit in the past but only to view schematics I’d downloaded elsewhere, I’d never tried to actually design anything in it, it seems rather dated in its design and I don’t think I’m being unkind in saying it isn’t the most intuitive piece of software ever designed but I soon got the hang of it and to be fair, it is pretty good at its job once you get to grip with its foibles.
I decided to use the Chinese site SeeedStudio.com to produce the boards, they don’t take Eagle files directly but Eagle can export the Gerber files that they need and they have an Eagle design rules file that makes it easy to check that your board fits with what they are capable of producing and a job file for the Gerber export to make sure everything is setup correctly for them. It’s still worth double checking the resulting Gerber files in a viewer such as Gerbv to make sure everything has come out as intended, I found that some of the silkscreen text that looked fine in Eagle had overflowed the board in the Gerber files.
Continue reading TinyTX Wireless Temperature Sensor PCB
I was poking around in the JeeLabs RF12 library recently (now part of JeeLib) and noticed that it now supports the ATtiny microcontrollers – it’s what the new JeeNode Micro uses, which got me thinking about even smaller, simpler wireless temperature sensor modules again. If you aren’t familiar with the Atmel TinyAVR range of microcontrollers they are the little brother of the ATmega that is used in our old friend the Arduino, smaller and lower cost, they are ideal for simple applications like this. The Arduino platform doesn’t support the ATtiny out of the box but thanks to the arduino-tiny project that is easily fixed, more on that later.
The version of the TinyAVR that I’m using here is the ATtiny84, it’s a 14 pin DIP package with 8KB flash, 512 byte RAM, up to 11 GPIO pins, 8 with ADC, and support for SPI, plenty to easily support the RFM12B and a temperature sensor. Using the ATtiny84 has allowed me to build my smallest (4cm square excluding the 2 x AA batteries), simplest and cheapest wireless temperature sensor yet which I’ve dubbed the TempTX-tiny, only 3 components are used, the ATtiny84 microcontroller itself, the RFM12B transceiver and a temperature sensor.
Continue reading An ATtiny based Wireless Temperature Sensor