TinyTX Wireless Temperature Sensor PCB

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.

After getting the design done I duly placed my order and sent the Gerbers off by email. A couple of weeks later and this lot landed on my doorstep:

Slap on an ATtiny84A microcontroller loaded with my TinyTX code, an RFM12B transceiver, a DS18B20 temperature sensor and a 4k7 resistor and connect it up to a couple of batteries and it’s good to go, uploading to my install of OpenEnergyMonitor emoncms via a Nanode and also displayed on my graphical displays. Here’s the completed board on top of a 2 x AAA battery holder:

I went with 2 x AAA batteries when I made this one up as it shows off its diminutive dimensions but AA could of course be used for more capacity and that is what I’ll probably use on most of them. A 3V coin cell could also be used but they don’t have a lot of capacity so I don’t think they really make a lot of sense unless size is critical. The pad spacing for the DS18B20 sensor also allows for a 3 pin header to be fitted instead allowing the sensor to be remote from the board on a plug in lead if desired.

For 10 boards it cost 10 USD + shipping which worked out at £9.42 including UK delivery, so 79p per board given that I actually received 12, not bad at all and the quality is excellent.

I’m pretty happy with how it came out for a first try, the only bit that I would do differently in retrospect is the spacing between the RFM12B and the pads at the bottom is a little tight, I’m going to blame the JeeParts library for that one as the outline it shows in Eagle for the RFM12B is smaller than it is in reality. It still fits though.

Here is a picture comparing it with (left to right) my original prototype ATmega328 powered stripboard version, the improved ATmega328 stripboard version (one of several in use) and the ATtiny stripboard version. Quite an evolution.

Make your own

You might notice the Open Source Hardware logo on the top right of the board, I’ve licensed this under the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence and the design files and schematics are available if you fancy getting your own boards made up or want to use it as the basis for something else. You can find links to download the Eagle files and the finished Gerbers ready to send off to Seeed below. I’ve also uploaded the files to SolderPad here and as always you can get the latest code on GitHub here. The code needs to be loaded using the Arduino IDE and arduino-tiny core as covered in this previous post and requires a one line change to the OneWire library to get it to work with the arduino-tiny core.

Downloads:
Schematic
Eagle files
Gerbers
Code

Bill Of Materials:
1 x TinyTX PCB
1 x ATTINY84A-PU Microcontroller
1 x RFM12B Transceiver
1 x DS18B20 Temperature Sensor
1 x 4K7 0.125W resistor
1 x 14 Way DIP socket
1 x Double AAA or AA battery holder
Wire for antenna (165mm for 433MHz, 82mm for 868MHz)

Update: There is now a dedicated page for the TinyTX with more information.

34 thoughts on “TinyTX Wireless Temperature Sensor PCB

  1. Hey Nathan, your Attiny84 stripboard version of the sensor was quite an inspiration for me to create my own remote sensor, I added a JeePort, ISP programming header, SD card connector and a voltage divider for analog sensing purposes though.
    I also have one version based on ATTiny85, the ’84 is an overkill for just measuring temperature. With some tricks in the sleeve, the ’85 can have up to 4(!) inputs, that means you can make quite a mighty sensor, I will create such a sensor for a greenhouse monitoring project that will pick up temperature+humidity+light intensity+soil moisture
    check my blog for details.

  2. Hi Martin,

    That’s cool, some good ideas there. I wanted to keep this one as small as possible but have been thinking about doing another version with pads for all the available pins and a small prototype area so that it was more universal. I like what you’ve done with the configurable voltage divider, that’s a great idea.

    Very interested to see you’ve got an 85 sending Jeelib compatible packets, I’ll have to give it a try, I’ve got one around here somewhere.

    Have you looked at any sensors for humidity yet? I’ve been playing with a DHT22, it will go straight on in place of the DS18B20 with a little pin bending and swapping the 4k7 for a 10k but its no good below 3V which is a bit limiting, the SHT1x and SHT7x are better in that respect but not cheap.

    Cheers,
    Nathan

  3. I tested a DHT11, but that sensor is a joke. It only gives you integer readings, plus humidity readings are off by a magnitude compared to my room humidity meter. Another setback is the 3V low voltage threshold. The SHT11 is indeed better quality and supposedly works down to 2.4V, but is pricey. The quest for the right humidity sensor continues 🙂
    Maybe your voltage booster may help address the voltage issues?

  4. Yes, had the same thought about using a boost converter, that or adding more batteries and using a low dropout vreg like an MCP1703, neither is ideal and I’d rather find a better sensor if possible. I know what you mean about the DHT11, the one I had was useless too, the readings were way out but the DHT22 I’ve got seems miles better plus you can get a floating point value from them. Would be great if it wasn’t for the voltage requirement, usually you get a bit of room with data sheet specs too but this drops off almost immediately once it dips below 3V.

    Here is a picture of one fitted with a DHT22. Just got it running off a bench supply at the moment.

  5. Ah, depending where you look the min/max voltage for the DHT22 (aka AM2302, RHT03) varies but most sources seem to say 3.3-6V so at 3V it is already below spec. so there is some leeway after all.

    The stated current draw during reading varies too but seems to be below that of the DS18B20 if it is to be believed, I’ve had an ATmega/RFM12B/DS18B20 combo running for 6 months that I’ve been logging the voltage for and it’s only just dropped below 3V now so running the DHT22 off 2 AA may be do-able if it lasts at least that long, when the batteries drop below 3V I could just re-use them with one of the DS18B20 sensors. I’ll set it up with some fresh batteries and see how long it lasts.

  6. I had one of my sensors run off single CR2032 battery for a month, and it is only 220mAh..I had to do some power saving tricks though, I will make a writeup. For the ATMegas here is an excellent article on power saving techniques http://www.gammon.com.au/forum/?id=11497
    I am sure with properly designed software and hardware, it shuld be able to run for half a year at least

  7. This is great, and an excellent tool for a heating engineer or a home owner balancing/adjusting a heating system. I have a battery powered EmonTx with 3 x DS1820 sensors on 2m cables, but this would be much better.
    By watching the flow and return temperature over a few days, one can learn far more than simply trying to set it up in 1/2 hr or so. Really need one for each radiator.
    No doubt lots of other uses. good work!

  8. Thanks for this blog, I’ve also been inspired, I’ve used you design as the start of my own, slightly bigger PCB with the option of RF, SD card and Cr2032 mounted battery, depending on requirement. I’m also going to try out seeeduino for the PCBs they look very cost effective, I’ll write up the project on my blog when I’m done.

    Thanks for the inspiration, keep it up.

  9. Hello Everyone, Mr. Chantrell specially,

    I’ve been following this blog as time permits. I have already three V2 stripboard version and in one of them I connected a DHT22 along with the DS18B20 (for testing purposes).
    I’m far beyond your level with electronics so bear with me.

    The code I’m running is a slightly different version of Nathan’s for the Temp TX.
    I my first attempt of running the DHT22, I’ve made no change to the code and was ablr to run it to 2.86v. Below this the Temp TX stopped sending readings. I also noticed that the batteries were draining more quickly than before. Then I decided to connect the DHT22 vcc pin to a specific Atmega328 pin and in the code I turned off that pin by default. It is only live for about 2 1/2 seconds each minute. (This is a slow sensor. It need 2 scs to take a reading). I’ve since using three 2100 mAh rechargeable batteries (because their lower voltage 1.2v) and it’s running for a month now with very little drain.
    I also had to adjust the structure that carries the data between nanode and Temp TX to transport the additional humidity value. This brought a little problem that the remote sensors that do not have the DHT22 always show the humidity of 0 (zero). Some time I’ll think in a way to correct this.

    As time permits I would love to try to connect the BMP085 that I have directly connected to my nanodeRF (inside the house) to an even more improved Temp TX remote sensor.

    Thanks for your Blog and all this good content.

  10. Hi Luis,

    It’s really great to hear from people who are putting this stuff to use. In my experiments with the DHT22 I found that it started to return bad readings once it dropped below 2.95v, the transmitter will continue working down to around 2.1v before it starts to become unreliable.

    You are right about it being a slow sensor, I’m also turning it on once a minute and found it needed a couple of seconds too. It seems a good sensor for the money all things considered, I just wish it would work at lower voltages.

    Here’s the code I’m using with the TinyTX, probably not very different to what you are doing but might be useful to others: https://github.com/nathanchantrell/TinyTX/blob/master/TinyTX_DHT22/TinyTX_DHT22.ino

    Cheers,
    Nathan

  11. Hello Nathan,

    Thanks for replying!
    Your code is always welcome!
    Indeed it is a good sensor for the money. I could be less power hungry and will definitly make us more happy. (we can’t have everything…)

    Let me ask you one off-topic question: do you use any specific software to create the stripboard schematics you post with your projects?
    I’m using Fritzing (http://fritzing.org/) witch is a very capable software to create PCBs, but for stripboards maybe it’s not the best one.

    Best,
    Luís

  12. Hi Nathan,
    Thank you for the sketches which I’m really enjoying. I also consider ordering some PCB’s.
    I do though have some trouble with the sketch when dealing with negative temperatures. Do you have a fix for this? Maybe adding an offset before sending via rf?

  13. @Luis – I haven’t found any stripboard layout software that I’ve been happy with so I just draw them in Inkscape. Please let me know if you find anything good.

    @Troels – You are using the DHT22 I take it? I hadn’t tested that for minus temperatures (the DS18B20 works ok) but I’ve just stuck the DHT22 sensor in the freezer and that stopped working once it got below zero. I’ve found the problem, it’s a bug in the DHT22 library causing it to return a checksum error for negative temperatures, if you find the following section in DHT22.cpp and change:

    // Below zero, non standard way of encoding negative numbers!
    // Convert to native negative format.
    currentTemperature &= 0x7FFF;
    _lastTemperature = -currentTemperature;

    to:

    // Below zero, non standard way of encoding negative numbers!
    // Convert to native negative format.
    _lastTemperature = -currentTemperature & 0x7FFF;

    that will fix it.

    I’ve submitted a pull request to the master, in the meantime there is my forked version with the fix here: https://github.com/nathanchantrell/Arduino-DHT22

  14. No, I’m using the DS18B20. Do you have:
    tinytx.temp=(sensors.getTempCByIndex(0)*100); working with negative numbers coming in? In that case, my problem must be with the parsing software I’m running.
    I’ll probably have to look deeper into the raw numbers coming in from the rf12 🙂

  15. Oh.. I have just read your new post regarding the DHT22 mentioning me. I’m sorry for the misunderstanding – but glad it helped you discovering the bug 🙂

  16. Hi Troels,

    No worries, I’m all set for winter now, I probably wouldn’t have found out until then if you hadn’t prompted me to check.

    Yes, that code is working fine for me with negative numbers so must be something on the receive end I think.

    Cheers,
    Nathan

  17. Hmm.. The numbers coming in from my attiny84+ds18b20 right now is “OK 2 210 246” which is parsed as 63,186C – but should be ~ -18C (testing it in the freezer).

    Another node is reporting fine with “OK 1 21 10” which is parsed as 25.81C.

    Is the “210 246” correct – and in that case, how should it be parsed then?

  18. Martin Harizanov helped me out with the parsing error – there were a minor error in the prior version. So now everything is working 🙂

    How are you doing with reception for your tinytx? I’m having trouble receiving from the 2nd floor in the building (through one wooden floor + one brick wall) using 868MHz, 57.600 baudrate and 82mm antenna.

  19. Hello are not able to do stripboard would be able to have a printed circuit board to build your project.

  20. hello, i love your project man!

    am looking for someone who can build the TinyTX wireless node but not only with Temp sensors but also with the following:

    * Relative Humidity and Temperature (digital)

    * Barometric Pressure (digital)

    * Light Sensor (digital)

    can some one please email me on: tarik at Chrigui. com to discuss more details about it.
    many thanks

  21. Hi Ralf,

    I haven’t done any documentation on that side of things yet.

    First of all you will need an RFM12B on the Arduino, for a 5V Arduino you need a voltage regulator and some resistors to drop the voltage to 3.3V, you can either use a breakout board like this one from JeeLabs or make something yourself based on the schematic. Or just use a NanodeRF which has RFM12B and ethernet onboard.

    Here is a basic sketch that just receives data via the RFM12B and outputs on the serial console.

    For a Nanode or an Arduino with an ENC28J60 based ethernet adapter this sketch will upload multiple transmitters to OpenEnergyMonitor emoncms or this one will upload a single transmitter to Cosm.com

    For an Arduino with a Wiznet W5100 or W5200 based ethernet adapter this one will upload multiple transmitters to emoncms, this is what I am currently using on a MAX1284 prototype. If using a W5100 based shield you will need to change #include Ethernet52.h to #include Ethernet.h

    That the sort of thing you were looking for?

  22. Hi Nathan,
    I built the TinyTX wireless node with a DS18B20 temperature sensor on a breadboard to test. I loaded up the TinyTX_DS18B20 code via an Arduino. I then hooked up a JeeNode with RFM12B board to test the receiver end. I noticed that you changed the TX code to include ACKs but not the code for TinyTX_RX_Simple. I added the ACK code from the TinyTX_Water_RX but I saw that the TinyTX node kept retrying the send even though the RX side was sending ACKs. I used the RFM12demo sketch on the RX side and it only behaved correctly with the TX side only sending one packet.

    I then figured it out. The TinyTX_RX_Simple code was running the serial line at 9600. The code then outputs lots of messages to the serial line before getting around to sending an ACK back to the TinyTX node. The TinyTX node only waits around 10 milliseconds for a reply so the fix was to save the contents of the payload received and then immediately ACK the packet before sending to the serial line the messages.

    The code on the RX side now works perfectly and I have shown the loop() section below in case anyone else gets stuck on this:

    void loop() {

    if (rf12_recvDone() && rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0) {
    nodeID = rf12_hdr & 0x1F; // get node ID
    rx = *(Payload*) rf12_data;
    int value = rx.rxD;
    int millivolts = rx.supplyV;

    // send ack if requested
    if (RF12_WANTS_ACK) {
    rf12_sendStart(RF12_ACK_REPLY, 0, 0);
    Serial.println(“-> ack sent”);
    }

    Serial.println(“Received a packet:”);
    Serial.print(“From Node: “);
    Serial.println(nodeID);
    Serial.print(“Value: “);
    Serial.println(value);
    Serial.print(“TX Millivolts: “);
    Serial.println(millivolts);
    Serial.println(“——————–“);

    }

    }

    I love the site and the blog.

  23. Hello Nathan,

    I am totally new in this raspberry adventure but I have a short question regarding the transmitter : is that possible to use a simple 433mhz transmitter instead of the RFM12B? I am asking because the simple RF 433mhz transmitters are cheap, it’s about 2$ for the transmitter & the receiver.

    thanks in advance for your response

    olivier

  24. Hi Nathan, first many thanks for this nice project! I’m trying to copy your setup with a DS18B20, but I’m running into a strange issue. All code works well as long as I connect the DS18B20 directly to a 3.3V line, but from the moment I connect it to a digital output port and control the power as you do setting the port to HIGH, I only receive -127. I can reproduce this on a regular arduino setup and with two different DS18B20 sensors. I must be doing something wrong! Any clues? The only thing I modified was replacing the 4k7 Ohm resistor by a 4k3 Ohm one, but as said, when directly connected to a 3.3V line, all works fine. Leaving it like that would of course drain the batteries … 🙁

  25. OK, I finally managed to find it myself, (after some hours of debugging), so I’ll share it here for others as well: reinitialize the sensors after you power up your sensor every time again (duh …). Seems in debugging I moved out this one line (sensors.begin()), which explains why it was working from a 3.3V line as here the power was never cut and the one shot initialization of the sensor was kept.

  26. Hi
    I’m working in a project with an ATmega328 micro and DHT22 sensors to make an weather station,
    but i’ve a problem, i made the calculs with the ATmega328 consumption and the batteries would drain very quickly. so my question is, is there a way to make longer batteries times draining?

Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.