TinyTX Wireless Sensor

TinyTX3 Front and BackThe TinyTX is my Open Source wireless IoT sensor node, designed to be compatible with OpenEnergyMonitor, Nanodes and Jeenodes. It uses the Atmel ATtiny84 microprocessor and a HopeRF RFM12B transceiver module and is coded using the Arduino IDE with the arduino-tiny core.

Initially devised with the DS18B20 digital temperature sensor in mind it can also easily be used with a dual temperature/humidity sensor such as the DHT22 or an analogue temperature sensor such as the TMP36 or many other kinds of sensors, some examples are included below.

To power it I use two AA or AAA batteries, a 3v coin cell can also be used but as they don’t have a lot of capacity I don’t think they really make a lot of sense unless size really is that critical. Another option would be to use a LiPo battery.

The maximum voltage is 3.8v and minimum for the RFM12B to work is around 2.2v although the operational minimum for a complete sensor will depend on the characteristics of the actual sensing device used, for example a DS18B20 worked down to around 2.3v in my real word tests (data sheet value 3v) but the DHT22 only worked down to 2.96v (data sheet value 3v).

New: TinyTX3 is here, that’s the red one on the right, it now has 6 available I/O and prototyping holes. I will update this page with more details soon.

Possible uses

  • Temperature Sensor using a DS18B20 digital sensor and a 4K7 resistor (blog post, code)
  • Temperature/Humidity Sensor using a DHT22 and a 10K resistor (blog post, code)
  • Temperature Sensor using a TMP36 analogue sensor, fit the sensor in the reverse orientation compared to DS18B20 and don’t fit a resistor (blog post, code)
  • Flood/water leak sensor  using a 100K resistor and wire probes, also code to use a TinyTX as a receiver (tx code, rx code)
  • Light sensor using an LDR (Light Dependant resistor) and a 10K resistor (code)
  • Electricity consumption meter using an LDR and a 4K7 resistor (blog comment by Troels, code)
  • Reed switch for door/window monitoring with pin change interrupt to wake from sleep (code)
  • Hall effect sensor (magnetic field detector) using an A3214EUA-T or A3213EUA-T to monitor gas usage (code)
  • Rain gauge using a tipping bucket rain gauge (code)
  • BMP085 air pressure/temperature sensor (code)
  • Or many other digital or analogue inputs or switch contacts.

I’ve also included code for  receiving the transmitted data on a NanodeRF and relaying it to emoncms or Cosm (see bottom of page).


Some examples:

TinyTX3 DS18B20 TinyTX Programming TinyTX3_Comparison_s TinyTX3 DS18B20
TinyTX3 with DS18B20 Temperature Sensor Programming with an IC test clip Comparison of V2 and V3 TinyTX3 Pin labels
TinyTX V2 With the DS18B20 Temperature Sensor TinyTX V2 With the DHT22 Temperature/Humidity Sensor With 3 pin male header for plug in DS18B20 or DHT22 With female headers for sensor & resistor for experimentation.
Shown with LDR fitted
Leak/Flood alarm, TX on left and RX on right. With Hall Effect Sensor With magnetic contact/reed switch With DHT22 and boost converter board
With LiPo battery and USB charger With 5mm Screw Terminal for power connection Programming the ATtiny TinyTX V2 Pin labels


Open Source Hardware
The hardware design and software are completely open source, you can get the schematic, Eagle design files and Gerbers from the links at the bottom of the page or from SolderPad and the latest code is always available on GitHub here, you can also find a layout for the stripboard version of the TinyTx here.

It is all licenced under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence, see the link for the full details but basically you can copy or adapt it for your own use as long as you credit me and share the results under the same kind of licence. It’s not necessary but if you do use it, it would be nice to hear from you in the comments or by email, it’s always interesting to hear what others are doing with this stuff and sharing ideas is one of the key benefits that open source can bring.

Thanks must go to to JeeLabs, OpenEnergyMonitor and Nanode (in no particular order) for inspiration and for opening their designs as well as all the people who have commented in my blog posts on the development of the TinyTX and its predecessors. I’m pleased to see that my work has in turn inspired others such as Martin with his great TinySensor  and Phil’s Multi purpose ATtiny84 PCB, this is what Open Source Hardware is all about.


Components, what to buy and where
I usually buy my ATtiny chips from RS Components, I use the picoPower version, the ATtiny84A-PU which works down to 1.8v but the older ATtiny84V-10PU would work just as well, both will be slightly out of spec at 8MHz once the voltage drops below 2.4v but this seems ok in practice, a DS18B20 starts dropping out below that anyway and the RFM12B will give up below 2.2v so we’ll never get too far from spec. Don’t get the ATtiny84-20PU as that only works down to 2.7v at 10MHz.

You can also get the RFM12B from RS Components but SK Pang can be a little cheaper if you are only ordering a few, most recently I have been getting them from JeeLabs who do a pack of 6 for €29.50 (433MHz and 868MHz). The RFM12B is available in three frequencies but bear in mind that some of them can only legally be used in certain countries. The antenna will need to be sized for the board you choose and you will also need to change the #define freq line in the code if using something other than the 433MHz that I’m using.

Frequency Can be used in 1/4 Wave Antenna Length
433MHz Worldwide 165mm
868MHz Europe 82mm
915MHz USA & Australia 78mm

I chose 433MHz back when I first started playing with the OpenEnergyMonitor stuff as I wanted to retain compatibility with what they were using, I’ve heard anecdotal evidence that 433MHz passes through walls better but I don’t have any real evidence to back that up and it is a busy frequency so one of the others may be a better choice, you’ll have to make that decision yourself.

For DS18B20 and DHT22 sensors the cheapest I have found by far is eBay.  Don’t be tempted by the cheaper DHT11 sensor, the humidity accuracy is poor, it will only return integer values and only covers 0-50°C compared to -40 to 125°C for the DHT22.

If you want to get PCBs made up I can recommend the Chinese site SeeedStudio, for 10 boards in green (other colours are more expensive) it costs 9.90 USD + shipping which worked out at £9.01 including UK delivery (90p each) and it will only take a couple of weeks. 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.  If you don’t want to get 10 boards made up you could always build the stripboard version or the guys at were also kind enough to import the Eagle files into their site for me so you can order boards in a pack of 3 from them for $14.67 plus $5 for international shipping. Unfortunately they don’t support adding text to the silkscreen so you will lose all the labelling with their boards. I’m not selling any boards myself at the moment but might have something in the pipeline soon.


Software prerequisites
You will need the Arduino IDE of course and to use it with the ATtiny84 also requires installing the arduino-tiny core. To install arduino-tiny you just need to create a directory under your Arduino sketchbook directory called hardware and unzip the latest arduino-tiny from here into it. Now restart the Arduino IDE and you should see the new ATtiny entries under the Tools > Board menu.

You will also need to put the necessary libraries in your Arduino libraries directory, for each variation (eg. DS18B20, DHT22 etc.) I have linked to the required libraries in the comments next to the includes near the top. All variations will require the JeeLib library for driving the RFM12B.

If using the DS18B20 you will need to make a small change to the OneWire library to enable it to work with the ATtiny84, just open OneWire.h and below the line:

#include “Arduino.h”       // for delayMicroseconds, digitalPinToBitMask, etc


#include “pins_arduino.h”  // for digitalPinToBitMask, etc


Getting the code onto the ATtiny84

Programming shield with ZIF socket

Programming shield with ZIF socket

To get the code onto the ATtiny we need to use ICSP (In Circuit Serial Programming), you can use an ICSP programmer if you have one, otherwise a spare Arduino will do. I made up the little Arduino shield on the right using a scrap of stripboard and a ZIF socket to make it easier.

To use an Arduino as an ICSP programmer you need to load the ArduinoISP sketch on the Arduino and connect the SPI pins and reset between it and the ATtiny. A version of the ArduinoISP sketch is included in the examples directory with the Arduino IDE but it seems to be broken, if it doesn’t work download this one instead and load it onto the Arduino in the normal manner.

To wire it up on breadboard connect the Arduino to your ATtiny as follows:

Arduino ATtiny84
D13 Pin 9
D12 Pin 8
D11 Pin 7
D10 Pin 4
3.3/5V Pin 1
GND Pin 14
You should end up with something like this:
Programming with an Arduino

Programming with an Arduino

ATtiny84 arduino-tiny pins

To use an ISP programmer connect as follows:
Programmer ATtiny84
SCK Pin 9
MISO Pin 8
MOSI Pin 7
3.3/5V Pin 1
GND Pin 14

I’ve been using a cheap USB ASP programmer with an IC test clip which allows programming without removing the chip which also means that the chip can be soldered directly to the board without the need for an IC socket.

Programming with an IC test clip

Programming with an IC test clip

Once you’ve got the programmer sorted the first thing to do is set the ATtiny’s internal oscillator to 8MHz, to do this you need to go to Tools > board and select “ATtiny84 @ 8MHz (internal oscillator;BOD disabled)” and then use Tools > Burn Bootloader. Note that this isn’t actually burning a bootloader to the ATtiny (it doesn’t use one), it is just using this function to set the AVR fuses to configure the oscillator at 8MHz.

Now download the appropriate TinyTX code from Github, eg. TinyTX_DS18B20.ino if using a DS18B20 sensor and upload it using the Arduino IDE in the normal manner. If you are using an Arduino as the programmer the ArduinoISP sketch running on it will upload it on to the ATtiny transparently. You will probably get the following message twice:

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny84

but this can be safely ignored, as long as it says “Done uploading” at the end then you are good to go.

If you get some errors about expected identifier or ‘(‘ before ‘double’“ then you need to comment out the following line in ~/sketchbook/hardware/tiny/cores/tiny/wiring.h

#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

If you get “not in sync” or “protocol error” then try reducing the baud rate in the ArduinoISP sketch and in hardware/arduino/programmers.txt (under your Arduino IDE directory) as mentioned here, I had to do this to get it to work.


On the receiving end

OSWIN Open Source Wireless IoT Node

OSWIN Open Source Wireless IoT Node

At the receiving end I am now using OSWIN, my own design for an ATmega1284P based Arduino compatible, prior to that I used a prototype MAX1284 gateway and prior to that I used a Nanode. This relays the data to my installation of OpenEnergyMonitor’s emoncms which gives me nice graphs and visualisations of temperature, humidity, air pressure and rainfall as well as electricity and gas usage. Code for both is available below along with a simple receive example and an example to upload data to Cosm (what used to be called Pachube). I have also built a number of wireless graphical LCD displays that display the data and have their own temperature sensors built in and I’ve also experimented with the Raspberry Pi as a base station and that is also a good option if you want an all in one receiver and server.

Dials from emoncms displayed on an O2 Joggler

Dials from emoncms displayed on an O2 Joggler

emoncms multigraph

WiNode based GLCD with RGB backlight and touchscreen





TinyTXV2 Design files:
Schematic (PNG format)
Eagle files
Layout for stripboard version

TinyTX3 Design files:
Schematic (PNG format)
Eagle files
Gerbers (one per board) or 2 panelised on one board (you will need to separate them yourself).

Code for transmitters:
DS18B20 Digital Temperature Sensor
TMP36 Analogue Temperature Sensor
DHT22 Digital Temperature/Humidity Sensor
Light Sensor using LDR 
Electricity consumption meter using an LDR
Flood/Leak Sensor
Reed Switch for door/window monitoring
Hall effect sensor (magnetic field detector)
Tipping Bucket Rain Gauge
BMP085 I2C Air pressure/temperature sensor

Code for receivers:
Simple serial console receive example
NanodeRF multiple TX to emoncms relay
NanodeRF single TX to Cosm relay
MAX1284 multiple TX to emoncms relay
Flood/leak alarm receiver
Code for graphical displays

175 comments to TinyTX Wireless Sensor

  • shivalwolf

    This project is great.
    I was looking at doing exactly the same thing with the same sensor and RF modules.
    I have everything sitting on my workbench but due to work never got around to putting it all together.

    I was also stuck on afew parts that you have now answered, Time to make an array of sensors around the house to control the central heating/cooling

  • Dan

    Great project. What enclosures are you putting these in?

  • I’ve used a variety of boxes, some I just had around, all a little larger than I’d like, I’ve been struggling to find something that is a snug fit. For most of them I’ve just left it as the bare boards stuck to the battery holder with a double sided pad, they small enough that it’s easy to find somewhere unobtrusive to hide them.

  • renzo

    salve dove posso aquistare la scheda TinyTX Wireless Sensor
    hi where can I aquistare card TinyTX Wireless Sensor

  • Hi Renzo, I don’t have any for sale at the moment, you could get your own made up at SeeedStudio using the gerber files above or make one on stripboard.

    Next time I get some PCBs made I will get a few extra for sale.


  • renzo

    sin but are not practical stripboard, I would be grateful if you show me where to find the card TinyTX

  • renzo

    mi sai dire la dimensione (cm*cm) della strpboard per poter fare l’ordine??
    can you tell me the size (cm * cm) of strpboard to make order?

  • You need 15 holes by 16 rows which is approx 40 x 45mm.


  • elyob (@elyob on Twitter)

    Am pretty keen on using a Raspberry Pi as the receiver .. I know you are talking to open energy monitor about the RFM12 stuff .. is this something you are looking at long term?

  • Not sure yet, I’m pretty happy with the way things are set up at the moment but have got to have a play to way up the pros and cons.

  • Dan Fish

    Nathan – my order of 10 boards has just dispatched from seeedstudio :) Thanks for the designs. Just re RFM12 modules, jeelabs are quite a lot cheaper at the mo, with 6 boards for 30euro.

  • Dan, That’s great, really good to see other people using this, I know elyob above received his boards from Seeed this week too. That’s a great deal on the RFM12 as well, think I’ll have to get some ordered.


  • elyob (@elyob on Twitter)

    Yes, all arrived. Took a few weeks. Am trying now to write bootloader via both an arduino UNO and nanode. Not had any luck. Changed speed to 9600 but still get the errors mentioned. Not spent a lot of time so far, though.

  • renzo

    Who can I sell 3-4 TinyTX board?
    pay with PayPal

  • ziuras

    Thank you Nathan for good job.
    My 2 tiny-tx with 2xAA and LTC3525 are working now, another 8 are waiting for soldering.
    I found PP42WS boxes for room sensors.

  • khs

    Great project, thank you!
    I have problems compiling the sketches (all of them) with an Arduino UNO.
    What libraries did you use. I am using the very last ones from JeeLabs.,
    from TinyTX_DS18B20.cpp:16:
    ../Ports.h:447: error: conflicting return type specified for ‘virtual void UartPlug::write(byte)’

    and some more.
    Any help is very welcome

  • Pirik

    Thank you sharing your Project :)

    I have a similar error as khs !
    I tried in v 1.0.1 and 1.0.2 and with different version of libraries and still the same error :

    “In file included from …\jeelib/JeeLib.h:7, from TinyTX.ino:16:

    …\jeelib/Ports.h:447: error: conflicting return type specified for ‘virtual void UartPlug::write(byte)’

    …\hardware\tiny\cores\tiny/Print.h:73: error: overriding ‘virtual size_t Print::write(uint8_t)’ ”

    What libraries did you use ?

    Your help will be very usefull to us.


  • Hi khs & Pirik,

    I’m not able to test this right now (still at work) but it looks like this is being caused by a fix in the latest arduino-tiny core that was previously being worked around in JeeLib.

    Try this:

    Near the top of Ports.h find:

    #if ARDUINO >= 100 && !defined(__AVR_ATtiny84__) && !defined(__AVR_ATtiny85__) \
    && !defined(__AVR_ATtiny44__) && !defined(__AVR_ATtiny45__)

    and change to:

    #if ARDUINO >= 100


  • Pirik

    Hi Nathan,

    Thank You very much for your (very) fast reply :)
    (sorry disturbing you @work)

    Your trick solved previous error but …

    ARgg !! I have another error now :
    ../avr/lib/avr25/crttn84.o: In function `__vector_default’:
    (.vectors+0×2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_1′ defined in .text.__vector_1 section in core.a(WInterrupts.c.o)
    r:/arduino-1.0.2/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o: In function `__vector_default’:
    (.vectors+0×16): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_11′ defined in .text.__vector_11 section in core.a(wiring.c.o)

    googling now …

  • Ah, good news, looks like it isn’t a problem on Linux as it hasn’t affected me.

  • Pirik

    Ok, (I must reinstall my pc with Linux ;)

    Now, i try to debug the ATiny84 program with a serial console.
    What ATTINY84 pin must be connected to the rx USB-BUB ?


  • Pirik


    I don’t know how to connect ATTINY84 to a Serial console (debug attiny like arduino).
    I read this feature was integrated into the ATTINY84 (via Dwire).

    I activate Debug Wire DWEN=0 fuse with AVRDUDE (fuse calculated with and send into attiny84 then i try to connect PB3 (Atinny84 pin 4) but nothing work …

    Did you used the serial output to see how your attiny program works ?

    thank you

  • khs

    Hi Nathan,
    thanks for the hint with the tweak in the libraries, here Ports.h.

    Found it at under #5.
    There seems to be a second point to tweak in Ports.cpp, around in the middle of the file there is another :”#if ARDUINO >= 100 && !de…blah…”

    Deleted there also everything after “#if ARDUINO >= 100″ and it worked fine for me.
    Thank you

  • @Pirik, I’ve not used Debug Wire before but you can use SoftwareSerial which is built into the Arduino IDE:

    @khs, Thanks, missed the one in Ports.cpp, not strictly necessary here as we’re not using the UartPlug function but good to know just in case.

  • Alex Romp

    Any hints how you’re going to implement the Hall Effect Sensor with the TinyTX? I was hoping to use it similar to this guy:

    Basically I want to track my water usage along with my electricity, etc.

  • My plan is to track my gas usage, my meter has a pulse magnet in it so was planning on using a switch type sensor rather than one with an analogue output and just counting the pulses. I need to get on to that now you mention it.

  • Alex Romp

    Hmm, I should see if my gas meter has anything for pulse counting. Might be able to use the pulse counter on the emonTX for that.

    For the water meter since I can’t count pulses (looked into it) I’m thinking the hall effect is my only chance short of putting my own water meter in, which seems extreme. I found one I’m going to play with that supposedly amplifies the signal itself, but worst case I can run it through an op-amp to try to clean up the signal like the guy in that link did.

    Still waiting on half my parts to arrive from overseas. My Tiny TX boards are in Singapore right now, and my emonTX is in the UK (I’m in the US). The Raspberry Pi is backordered but hoping to see that in the next few weeks. I’ll try to put something basic together once my hall effect sensors show up just to see if it’s even possible with my meter.

    Thanks for the info and great site. I look forward to your next article!

  • Tailzer (@Tailzer on Twitter)

    This is exactly why open source and open hardware is so great, I now have wireless temperature feeding into my OpenEnergyMonitor page and I’ve learnt a little more about Arduino’s and AVR’s.
    Great job, thanks for the info and more importantly the inspiration!

  • Thanks for the kind comments Tailzer. I’m really pleased this has been useful to people, I’ve had so much benefit from open source software and hardware over the years and it’s great to be able to give something back that other people find useful.

  • iwan

    This is the perfect solution for what i am looking for.

    But i am missing 1 thing… it possible to connect a moisture sensor to this board…so that i cn see the moisture of my plants and ad that ass whell to my openenergy monitor..

    hope you can help me with this. I will start with the first sensor as soon as possible…

    GREAT work…..really super.

    many many thansk from The Netherlands

  • Can

    Hi Guys,

    thanks for this great project! Just one question, is it possible to run this code on an attiny44 as well?

  • @iwan The water leak sensor is essentially a moisture sensor, eg. a 100K resistor fitted and probes on A0 (ATtiny pin 13) and ground. The code I wrote for that just sends a code of 999 if the reading was over 400 but it would be easy to adapt to send the reading instead.

    @Can Some of the examples will fit on the 44 but not all of them, the DS18B20 code needs an 84 for example.

  • iwan

    @ Nathan,

    thanks for the info….i am going to build me a small network with these sensors…

    hope this works…

    great stuf..


  • Maurycy

    I would like to know if it’s possible to use attiny85 instead of attiny84?

  • Not with the same code but I know that Martin has had some success getting the 85 to work with RFM12B sending Jeelib compatible packets. See his post here:

    and the sketch in Digispark examples might be of help:

    I haven’t tried this yet but have got some Digisparks (ATtiny85 based) and RFM12B shields so will get round to it at some point.


  • Maurycy

    Thanks for information.

    I will try to do it on attiny84 first, next will try 85.

    It’s great project.
    I will follow Yours Digisparks projects.


  • Can

    Thanks for this Information. So i will try Attiny84. Finally i found some and have already fleshed one with your code. Hopefully my RFM12B mosules will arrive soon.

  • Daniel

    Is it possible to use DS18S20 Sensors instead of DS18B20 Sensors with th Tinytx-Board??? I tried it and I always get 85 degrees from the sensor which is a default value for the case that something went wrong. Are changes in the Code from the tinytx neccesary??? Or is it the Library which does not support the DS18S20 Sensors?? (btw the DHT22 Sensor runs great on the same board with the other code).


  • I’ve never tried the S20, it doesn’t look like you need to do anything different but I note on the page for the Dallas Temperature library it says there have been problems reported with it but no more than that:

  • Jan


    I finally managed to run emoncms with two temperature nodes. I would like to say big thank you… :-)

  • Maurycy

    Hello Jan

    Can I ask for a code for it?
    I did some tests with DS1820 and for now I have one cosm stream:
    I have some problems with multiple streams. Do You use uno on nanode?


  • Jan

    Hi… I use Raspberry PI with RFM12Pi end emoncms. You can see here… . Upload is done once per 5 minutes from mysql database. I had also problem with csv values. I had to use json. the main part is here:


    for i in feed_2 feed_3 feed_4 feed_5
    php export.php $i > /tmp/${i}.dat
    curl –request POST –data-binary @/tmp/${i}.dat \
    –header “X-ApiKey: ****KEY****” \${i}/datapoints/

  • Can

    Hi Nathan,

    really great Project! I’ve soldered three nodes already. But i’ve a question about the sending intervall. It should be 1min. in your sketch. But from time to time i get 5 times in row a temp value of one node. Is this behaviour normal?

  • @Maurycy/Jan That’s handy. I went with a slightly different method for feeding from emoncms to cosm, instead of pushing to cosm I use this bit of php to provide a .csv for cosm to pull from:
    The downside of this method is it will only update cosm every 15 minutes.

    @Can That will be the ACKs causing that, with the default settings if the TX doesn’t get an ACK back from the base then it will retry up to 5 times. If you are only seeing it occasionally then it is probably interference or contention causing it to miss the ACK.

    You can adjust the number of retries and time to wait for a reply, or turn ACKs off altogether with these defines:

    #define USE_ACK // Enable ACKs, comment out to disable
    #define RETRY_PERIOD 5 // How soon to retry (in seconds) if ACK didn’t come in
    #define RETRY_LIMIT 5 // Maximum number of times to retry
    #define ACK_TIME 10 // Number of milliseconds to wait for an ack


  • Can

    Thanks a lot for this absolutely fast reply. I think this will be the reason. I will test it.

    I would like to put a led on the circuit that blinks when the rfm12 send a packet. But how do i manage this? I’ve tried something like if(rf12_send){ledPin = HIGH}
    But rf12_send has no statement…

  • How about turning the LED on after rf12_sendStart and then off after waiting for an ACK, something like:

    rf12_sendStart(RF12_HDR_ACK, &tinytx, sizeof tinytx);
    digitalWrite(ledPin,HIGH); // Turn LED on
    rf12_sendWait(2); // Wait for RF to finish sending while in standby mode
    byte acked = waitForAck(); // Wait for ACK
    digitalWrite(ledPin,LOW); // Turn LED off
    rf12_sleep(0); // Put RF module to sleep
    if (acked) { return; } // Return if ACK received

    Will that do what you want?

  • I’m using RFM12B chips from here..

    They cost 2,5eur piece… pretty cheap…


  • Can

    Pefect, thanks a lot! Now i’m running evveything the way i like it!

  • Jan Pacák


    I’ve seen very nice programmer. Where did you bought the white plactic pin?

    Thank you


  • Hi Jan, I got the IC test clip for programming off ebay:


  • Jan Pacák

    Thank you,

    i bought one… :-) I was thinking whether to directly solder attinu84 or use socekts… now i soldered directly…

    Thank you


  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    is possible to use the tinytx wireless sensor with two CT sensor or one CT sensor ?


  • Spexx

    I can burn the bootloader and upload the blink sketch to my ATtiny84 via an ISP-Programmer, but the LED won’t blink :( If I use another fuse setting from Github, the blink sketch works without problems but I can’t use the JeeLib library… What’s wrong?

  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    if I want to connect BMP085 at the Tiny TXV2 is possible ?


  • You can try this code here, it has been working fine for me but I know a couple of other people have been having problems that we haven’t got to the bottom of yet:

    On the TinyTXV2 connect the BMP085 SDA line to D10 and SCL to D9
    See this picture for which is D10 & D9 on the V2:

    In the code you would need to comment out the line:
    PortI2C i2c (2);

    and uncomment:
    // PortI2C i2c (1);

    You won’t be able to connect the power via a pin on the V2 so connect it to Vcc and comment out the following in setup():

    pinMode(BMP085_POWER, OUTPUT); // set power pin for BMP085 to output
    digitalWrite(BMP085_POWER, HIGH); // turn BMP085 sensor on

    This is the BMP085 breakout that I used:

  • John Doe

    Hey Nathan,

    What kind of range do you expect on this wireless sensor with the Raspberry Pi wireless base station? I’m thinking of making a water temperature buoy at my summer house and the buoy will be about 500ft away from the base station. Is that too far?

  • Chris

    I’ve been working on a modification design for the TinyTX v3 board. A change that I’ve finished is converting to SMD components. The other change I’m half done with is making it easy to connect a Li-Ion battery.

    I’m planning on placing TinyTX boards around a house that has an openenergymonitor project installed for recording room temps among other things, and I’m trying to come up with a way to get them portable.

    I’ve run into a problem where the Li-Ion battery, when fully charged, has a voltage of about 4.1v but the RFM12 module can handle a maximum of 3.8v. I’d like to regulate the voltage to make sure it’s safe to connect a fully charged battery. After talking with a guy at work who does electronics design, he suggested looking into a low dropout regulator chip. I see output voltage ratings for 3.3v and 3.6v.

    I’m wondering what voltage would be the best for output. If the battery starts at 4.1v and I regulate it down to 3.3v, wouldn’t it be wasting charge? I’m wondering if anyone knows if it would be more energy efficient to regulate to 3.3v or 3.6v? Also, what would be the best voltage for sensors? I’d like to be able to use as many types of sensors as possible (see examples above).

    Also, I’m wondering what current rating the regulator should have? Does anyone have experience with how much the RFM12 module and a simple sensor or two draws? Would 50mA or 100mA be enough?

    Thanks in advance!

  • @John Doe 500 feet might be a bit too far, I usually say 120 metres (~400 ft) with clear line of sight and around 20 to 30 metres indoors through a few walls although that really can vary depending on the construction of the building and interference/contention with other devices. The 433MHz version should in theory have slightly better penetration through walls but that’s all I’ve used so haven’t done a real world comparison to 868MHz.

    @Chris Sounds good. You’re right that regulating down from 4.1V to 3.6V is going to be slightly more efficient but watch out for how quickly the battery voltage drops, I’ve not tracked one but as they have a nominal rating of 3.7V I imagine it will drop to a level below what the vreg requires pretty quickly so you might actually get longer out of a charge by regulating to 3.3V. Worth checking anyway. 50mA should be plenty.

    As far as the sensors go, either voltage would be ok, all the sensors I have used range from at least 3.0 to 5.5V apart from the BMP085 pressure/temp sensor which tops out at 3.6V.

    For what it’s worth I have run one with a DS18B20 directly from a LiPo battery without any regulation, yes 4.1V is slightly outside the recommended operating range for the RFM12B but it is still within the absolute max rating. I couldn’t say whether it effects the longevity but it has worked ok for me so far. YMMV of course.

  • John Doe

    Ok, The buoy is 130m away according to google earth. Do you know of a way to improve the wireless signal? Will a better antenna help?

  • That’s close enough that I would think you would probably be able to make it work with the right positioning and antenna, antenna theory gets complicated quickly though and it’s not something I’m well up on at all as the range has been fine for my needs.

    This document from Hope (manufacturer of the RFM12B) is interesting and might be of help:

    Another option would be to use a different radio, the SRF from Ciseco is footprint compatible with the RFM12B and I’ve had one working with the TinyTX3, see pic here: (the extra grey wire isn’t required for a transmit only node). It is a bit more expensive but is supposed to have a much higher range than the RFM12B (some claim as much as 3km!), I’ve not written any complete code for this yet but it would be easy enough to do as it is only working like a transparent serial connection in its default configuration. I was using their Xbee compatible XRF on the receive end when testing but they have other options like a Raspberry Pi board and USB stick. See

  • Here’s a useful post on JeeLabs about extending the RFM12B range.

  • khs

    still playing with the TinyTxs, used a handful for hydronic balancing of our heating system using emoncms.
    Now I want to use emoncms to look after power-, gas- and waterusage; we have all the meters in one room (max. 1 meter apart) and they all deliver pulses. My idea is to use the TinyTx as “frontend” to connect to the meters and my Nanode to connect via cable to the TinyTXs. The RF of the Nanode shall be used for additional equipment, the ethernet to emoncms.
    So how to connect the TinyTX and the Nanode?
    What is necessary for the SW?
    Is the Nanode capable to fulfill such a job?

    Any ideas, comments or help is very much appreciated:

  • Would the TinyTXs be necessary? Could you not just connect the sensors for the three meters directly to the Nanode and code something for that to read the relevant inputs and upload to emoncms.

  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    I have connected the BMP085 at the Tiny TXV2 we you suggest me and I make the change at the code, but doesn’t work.

    I try the same sensor whit Arduino Uno and the BMP085 work without problem.
    When try to use the Arduino I see just one issue, if I use the analog ground of Arduino the BMP085 doesn’t work but if I use the digital ground the BMP085 work without problem.
    Is possible the same issue are in the tiny TXV2 board ?
    What do you think about ?

    Best Regads

  • Pirik

    :) Thank you for the new version of TinyTx Nathan !
    I just send your v3 Gerbers to SeeedStudio.

    For Windows 8 users : try Online Gerber viewer :

    Best Regards,

  • Spexx

    Are the values for the antenna length correct? Lambda/4 for 433MHz should be 173mm, or not?

    ~300000/433/4 = 173?

  • @Francesco Sorry I missed your post, the ground won’t be an issue if you are using the ground pin of the 3 pads as it is directly connected to the main ground. I’ll give it a try on a V2 later.

    @Pirik Great to hear!

    @Spexx To be honest I just used what everyone else is using with the RFM12B (openenergymonitor, Jeelabs, Nanode and more).

    Looking into it some more it appears to be calculated using the 468/f formula for a half wave antenna:
    Half wave = 468/433 = 1.080831409 feet = 329.437413 mm
    So divide by two for a quarter wave gets you 164.7187065 mm

    I don’t know enough antenna theory to tell you if that is correct but I read that the 468/f formula is supposed to take into account some of the real world effects of a shorter antenna.

  • PACi

    468/F is bad… se investigation

  • @Francesco Just tried it and it worked fine for me. Referring to the pin labels on this picture:

    I connected:

    BMP085 SCL to TinyTX Pin 12 (A1/D9)
    BMP085 SDA to TinyTX Pin 13 (A0/D10)
    BMP085 GND to TinyTX GND
    BMP085 VCC to TinyTX VCC

    No resistor fitted.

    and this is the code I used (just the changes I mentioned further up):

    @PACi Interesting history of how it came about but as some of the comments say I don’t think it is necessarily bad as such as long as you accept it for what it is, just an approximation or a starting point based on the fact that RF travels slower through a conductor than through a theoretical free space. 300000/433/4 isn’t exactly correct on that basis either.

    With a higher power transmitter you’d want to tune the antenna manually to get the perfect length of course but with the low power of the RFM12B and the fact it has automatic antenna tuning I don’t suppose it is that critical here. Would be interesting to see some results comparing 165 v 173 mm though.

  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    no problem I Will wait your test ;-)


  • Francesco (@fparodo on Twitter)

    Hi Nathan

    thanks for yours test I will try soon as possible and I report the result.
    Sorry for the previous post but I have a proble with my internet connections.


  • Spexx

    Ok probably there aren’t any differences between the antenna length, but maybe someone has some time to test it :-)

    By the way: Thank you, Nathan for this great project. I have ordered the TinyTX3 at SeeedStudio and they are working perfect.

  • Keith

    Pretty new to this but trying to get my head around it all. Have build a board but have an error with the DS18B20 sketch. Comes up with:

    In file included from TinyTX_DS18B20.ino:14:
    /Users/……/Arduino/libraries/OneWire/OneWire.h:8:10: error: #include expects “FILENAME” or

    Sketch is unmodified, have added OneWire and library and made the mod but not sure where the issue lies. Any idea?

  • Hi Keith, When you have added the extra line to OneWire.h check you have got proper quotes around pins_arduino.h if you copied and pasted it might have given you “ instead of ”


  • Well there you go, it screwed that up for me too.

    Maybe this will work:

    #include "pins_arduino.h"

  • Keith

    Thanks very much, that seemed to do the job. Had a further CrossPack compile error which seemed to be mac related and found a fix here for anyone else that has the same issue:

  • John Slee (@indigoid on Twitter)

    Have you arrived at any kind of solution for building this stuff from the commandline? I’ve tried to get it going with scons+arscons… Just get annoying Python errors whenever I change the board type to seemingly anything other than atmega328

    [jslee@shamata TinyTX_TMP36] $ scons ARDUINO_BOARD=attiny84at8
    scons: Reading SConscript files ...
    ValueError: too many values to unpack:
    File "/Users/jslee/Code/avr/sketchbook/TinyTX/TinyTX_TMP36/SConstruct", line 167:
    'cores/', getBoardConf('build.core', 'arduino'))
    File "/Users/jslee/Code/avr/sketchbook/TinyTX/TinyTX_TMP36/SConstruct", line 157:
    key, value = line.split('=')

    Unfortunately I am a Perl guy… Python might as well be from Mars

  • I’ve never used it myself but I know someone who uses scons with the TinyTX code, I’ll point him in this direction.


  • Kyle Gordon (@kylegordon on Twitter)

    Is it on a Mac? I wonder if it’s choking on a directory path with spaces in it? Can you let us know the response to ‘pwd’ please?

  • John Slee (@indigoid on Twitter)

    Yeah it’s a Mac… No spaces though. Path is /Users/jslee/Code/avr/sketchbook/TinyTX/TinyTX_TMP36

  • Cody Clingan (@codyaclingan on Twitter)

    I’m very new to the world of sensors and wireless networks, so I apologize in advance if this is a dumb question. I’m wondering how well this would work with something like this… . If not, do you have any suggestions? I want to have multiple wireless motion sensors relaying back to a base station to track a person’s full body movement. Thanks!

  • In theory yes but existing Arduino code won’t work without (potentially a lot of) modification as it uses an I2C interface and the ATtiny84 doesn’t have hardware I2C like the ATmega328 etc. does. That’s going to be the problem with all these kind of sensors. I’m currently waiting on delivery of some PCBs for a TinyTX sized 328 based board that will make things like this much easier.

  • John Slee (@indigoid on Twitter)

    SMD ’328, I hope.

  • Yep, TQFP 328, 0603 passives, all pins exposed and slightly smaller than the TinyTX. Hence the experimentation with the hot plate reflow soldering. Should have them in the next week hopefully.

  • PACi

    It’s bit pitty. This can’t one solder at home :-(

  • DinoN

    I see place for 2 capacitors on the board. are they required and what is their specification

  • @DinoN They are 0.1uF (100nF) and not absolutely necessary (they are decoupling capacitors), the previous version didn’t have them and I had no problems but it is good practice to have them, you can always add them later if you have problems.

    These are the ones I’ve been using:

    @PACi Here’s the new board, it is definitely possible to solder at home without too much trouble:

  • Teo770

    Is there a way to add pins to plugg a FTDI USB/TTL programming interface ?

    Like this one:

    So, it will allow to reprogram the chip more easily ?


  • John Slee (@indigoid on Twitter)

    Re: programming – TinyTX won’t stay Tiny if every feature is added. :P I think as long as DIP is used there is no need for a programming connector.

    Instead you can build something like the crappy but functional adapter I made, and then use a Bus Pirate (my preference), USBASP, or similar,

    Or do what Nathan does and use an IC test clip.

  • Teo770

    Just wanted to know if i could solder pin headers on the board to plug my FTDI adaptor when needed. But when i read new tiny328 features compared to titnyTX3, it looks Tiny84 is lacking Hardware USART so…. i imagine it’s not possible ?

  • Yes, FTDI isn’t possible because it doesn’t have hardware serial.

  • Hi,

    thanks for your very nice idea!

    I am not an expert with board layouts, but would it be possible to make a one layer Eagle board, so that we can produce them by ourselfs the easy way?

  • Keith

    Hi Nathan,
    Thanks so much for sharing and all of this, I’m now up and running with 4 sensors now feeding temp and humidity into emoncms. I struggled to get them working at first as they weren’t being spotted in my list of nodes but I found disabling ACKs in the Tiny code did the trick. Happy they are all working but wondering why this would be the case.

  • Troels

    Hi Nathan,

    I am trying to turn your Water_RX into a relaying sketch (as my Water_TX is too far away from my server) by adding the following (bottom line):

    if (RF12_WANTS_ACK) { // Send ACK if requested
    #ifdef DEBUG
    Serial.println("-> ack sent");
    rf12_sendStart(RF12_ACK_REPLY, 0, 0);
    rf12_sendStart(0, &rx, sizeof rx);

    The led is still flashing just fine, but the rx-node never relays the data. Do you think you can help me out?


  • @Troels Try it with a delay (50) before your new line, that works for me.

    @Keith Not sure why that would be, what code are you using on the receive end?

    @Igotcha Are you thinking of a board you could etch yourself?

  • Troels

    That did the trick. Thanks! =)

  • Yes Nathan, a single layered board that we can etch by ourselves.

  • casestudies

    I’m having a lot of trouble compiling an Arduino sketch for the ATtiny84 chip. I followed the above instructions for the arduino-tiny at Google Code as well as a package from an MIT site, and many other hints on the web, but can’t seem to get it to compile when using the attiny84at8 settings. It compiles fine if using the ATmega328 setting. I’m using a program called “ino” for compiling Arduino sketches on the command line so that I can get the hex file to burn to the chip. Again, it compiles fine when using ATmega328. It’s running on a Raspberry Pi Arduino v 1.0.1.

    I was wondering if you have happened to come across the following error message during compiling.

    pi@emoncmspi ~/TinyTX/TinyTX_RX_Simple/ino $ ino build -m attiny84at8
    In file included from /usr/share/arduino/libraries/jeelib/JeeLib.h:7:0,
    from .build/attiny84at8/src/TinyTX_RX_Simple.cpp:2:
    /usr/share/arduino/libraries/jeelib/Ports.h:696:49: error: âSerialâ was not declared in this scope
    /usr/share/arduino/libraries/jeelib/Ports.h:697:60: error: âSerialâ was not declared in this scope
    make: *** [.build/attiny84at8/src/TinyTX_RX_Simple.o] Error 1

    Any hints would be great! Thanks.

  • Ah, I think I see the problem, that code was written to run on a 328 as the receiver not an ATtiny, not very clear in retrospect. The problem is that the tiny doesn’t have hardware serial support so if you want to get debug messages you will need to use software serial and connect a couple of spare pins to a uart adapter or to the RPi uart headers.

    It’s a bit late here but briefly you will need to add this before setup()

    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(RX, TX);

    Where RX and TX correspond to the (Arduino numbered) pins that are connected to the uart and then change all other occurences of “Serial.” to “mySerial.”

    Hopefully that will give you a start but let me know if not.

    Hope that makes sense, it’s 4am here!

  • casestudies


    Thanks for responding so quickly. I had thought it had something to do with the attiny not having hardware serial from some of the reading/googling I did. I tried adding the lines you mention above and changed Serial to mySerial in the sketch, but it still throws the same error. I then tried commenting out all the Serial lines, still with no luck.

    For kicks, I tried compiling TinyTX_LDR.ino in the same manner, and still receive the same error message from jeelib/Ports.h. Looking at this sketch, it seems to indicate it was written for the attiny84 in the comments, and I see no lines mentioning Serial.

    Again, any suggestions of things to try would be great! Thanks again!

  • Looking at it with a clear head I can see the error is actually coming from the Jeelib Ports library. I think this is probably something to do with inotool, have you tried compiling in the Arduino IDE?

  • Piotr


    I’ve made such sensor using ds18b20 and atmega328p, powered from 2 AA.
    But it works fine only on fresh AA.
    When power drops to 3150, temperature sensor shows -127C. On fresh AA it works just fine.

    Is is possible, that it requires at least 3.1 V to stable work?

  • Elyob (@elyob on Twitter)

    Piotr, generally speaking, I’ve been adding voltage step-up to my tinytx v2, as yes, low voltage stopped it all from working .. I always intended to use v3 and also monitor the ‘real’ level for alert purposes. Never got around to that. Have also been wondering about adding a load of batteries and using step-down & up .. if such a thing exists. Some of my sensors are quite important and keeping a steady signal needs improved on my setup. Was also looking at some of Martin Harizanov’s Funky scripts, which include a wake up to report battery level (e.g Any thoughts on this Nathan?

  • Piotr

    Thanks for reply.
    At what voltage Your sensor stopped working?
    On fresh AA voltage was 3180. At 3150 i was getting strange readings ex. 20 C, then -4, then – 77, 15. At the end – 127 C.

    Maybe 3 AA in row will do the work?

  • That’s a puzzle Piotr, it should definitely be ok at 3.1V, the datasheet for the DS18B20 says 3.0V is the minimum but I’ve tested mine (tiny84 and 328 variants) down to 2.7V. Is it a barebones board you are using, just the 328, crystal, caps & RFM12B?

    I’ve only used a step up with the DHT22 although I’ve recently replaced one of those with one of my new 328 boards with 3xAA regulated down to 3v3, will have to see which works out best overall.

    To read the battery voltage when using a step up you can just connect the battery positive to one of the unused analogue inputs and read that, no need for a voltage divider as the battery voltage will always be lower than the vcc the mcu sees.

    This should do it:

    unsigned int millivolts = map(analogRead(A7), 0, 1023, 0, 3300);

    A timed wake up for things that aren’t regularly transmitting would definitely make sense.

  • Piotr

    Hi Nathan,

    I’m using 328p with 8Mhz, internal oscillator and rfm12b.
    I will check on spare AA pack.

  • John V.

    Hi Nathan,

    I’m using quite a few TinyTX sensors around the house and garden – thanks for making your design so freely available. At the receiving end is an RFM2Pi board made by Martin. Very happy with this setup!

    I saw your tweet about getting the RF signal strength from the RFM12B. Any plans to the incorporate this on the TinyTX?

    Thanks again man, very much appreciate your work.


  • Thanks John. Hardware wise it would be easy enough on a TinyTX3, just solder the wire from the capacitor on the RFM12B to one of the unused analogue inputs. Would it be useful on a sensor though? I’ll definitely be knocking up a display similar to the one in that forum post to do some testing, should help with locating sensors in the best spot, sometimes a few feet either way can make all the difference in reliability.


  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    is possible to modify yours code of Tinytx BMP085 air pressure/temperature sensor to work with jee node can you help me to modify yours code ?
    Please let me know


  • I haven’t tried it as I don’t have a Jeenode but I would have thought it would work as is, it is using the Jeelib BMP085 library after all. Make sure the PortI2C i2c (2); line is set to whatever port you have the BMP085 connected to.

  • Francesco (@fparodo on Twitter)

    Hi Nathan,

    is possible to use Tinytx board to control a relays boards ?


  • chris

    Hi Nathan,

    do you see any problems if I would like to connect both the DHT22 sensor and a reed sensor to a single TinTX3 board in order to use it as a combined temp, hum. and door/window open/closed sensor?



  • matthew

    ive been messing around with some of your TinyTX3 from
    i have a dht22 and a ds18b20 TX board running your code. my issue is i cant receive(anything), im using a uno with again your simple rx code. ive only been learning code for the past 3 months so im gessing the issue/solution will be real simple, any advice?

  • Daniel

    Hi Nathan,

    First, thanks for sharing all you work you have done with the tinytx!

    A quick question though, Im going to order PCBs from Seeed Studio, but it wasn’t
    clear for me what specifications to provide regarding PCB layer, PCB thickness and PCB dimension. Your input would be appreciated! :)

    Best Regards and keep up the good work!


  • chris

    Hi Nathan,

    I have a big problem.
    I ordered several tinytx-3 boards from seedstudio in order to build several “multi-sensor-nodes”. I got my prototype assembled and programmed quickly and the sensors are working. My problem is that the RFM12B does not send anything. I sniffed the air-traffic with a sdr device and double checked with another 433 MHz device which I can “see” sending.

    I also built a second prototype to make sure it is not a defekt RFM12B board. No luck either.

    I suppose it has something to do with the RFM boards being slightly different from the ones you are using:

    The boards are of the type “RFM12BSP” “REV.1.0″ as printed on the backside of the board.

    Can anybode give me hint how I can find out what the problem is?

    I tried the following basic scetch to test the sender alone:


    #define myNodeID 1 // RF12 node ID in the range 1-30
    #define network 210 // RF12 Network group
    #define freq RF12_433MHZ // Frequency of RFM12B module

    #define LED 0

    long counter;

    void setup () {
    rf12_initialize(myNodeID,freq,network); // Initialize RFM12 with settings defined above
    //rf12_sleep(0); // Put the RFM12 to sleep

    pinMode(LED, OUTPUT);

    digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(2000); // wait for a second
    digitalWrite(LED, LOW); // turn the LED off (HIGH is the voltage level)
    delay(2000); // wait for a second

    void loop () {
    digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
    rf12_sendNow(0, &counter, sizeof counter);
    digitalWrite(LED, LOW); // turn the LED off (HIGH is the voltage level)

    I expected the module to send a packet every second and the LED to flash while sending.
    However I see no “air-traffic” and after the first attempt to send the LED stays on forever.

    Any help is highly appreciated!!

    Thx, chris

  • Apologies for neglecting the comments lately.

    @Francesco – Yes, one of those little 5V relay boards with a transistor that you see on ebay would work, or something else you have built yourself as long as it uses a transistor to switch the relay (max current per pin is 40mA).

    @chris – No, don’t see any problems there, I would start with the code for the DHT22 and just add a digitalRead in the loop to check the reed switch state.

    @matthew – How is the RFM12B connected to your Uno?

    @Daniel – Already replied to this by email but for others:

    PCB Qty: 10 (no point going for 5 as the price is the same)
    PCB Layer: 2
    PCB Thickness: 1.6mm
    PCB Dimension: 5cm Max*5cm Max
    PCB Color: Green
    Surface Finish: Hasl

    @chris – Your code works for me (with the added JeeLib.h include that I assume WordPress mangled otherwise it wouldn’t have compiled) and that RFM12B just looks like the version that has the exposed chip and a flat crystal, I’ve used lots of those here so I don’t think that is your problem.

    Have you soldered all the pins on the RFM12B or only some? If only some then make sure you have connected SDO and nIRQ on the left and nSEL, SCK, SDI, GND, VDD and ANT on the right according to the pinout here:

  • chris

    Hi Nathan,

    thx for your reply!
    Did you actually try my test-code? Did you receive messages regularly then?

    I have connected all contacts and checked all connections several times (always measured from the Attiny-pin to the RFM12 port) – can’t find any problem there. As mentioned I have built 2 complete devices with same result …

    I did not install the 2 capacitors yet (did not have any available) but as far as I understood this should not make the difference right?

    One thing that is definately different with these boards: They obviously have a fixed frequency (they have various frequencies printed on the backside and 433 highlighted with a marker). So I wonder if they might need a different initialization ??

    How could I debug what is actually going on? I am even unable to display any printf – debug messages. How could I establish a serial connection to my PC?

  • John Slee (@indigoid on Twitter)

    If you have an AVR Dragon (or USBISP I think?) you should be able to use debugWIRE which will give you a 1-way serial interface on… PB1 I think. See the ATtiny85 datasheet

  • Chris, Yes, I tested your code, I didn’t have an LED connected but I was receiving the incrementing counter from it ok.

    All the RFM12B boards are optimised for a set frequency and are marked that way on the back so I don’t think your RFM12B is wrong/different. Here’s one of the one’s I’m currently using:

    I’m a bit lost as to what your problem is, I’ve never come across anything like that before. It’s certainly worth trying with the capacitors in but I’d be surprised if that’s what it was to be honest.

    For debugging over serial you can use SoftwareSerial and an FTDI adapter or a spare Arduino.

    At the top of your sketch add:

    #include <SoftwareSerial.h>

    SoftwareSerial mySerial(-1, 3); // RX, TX

    and then it’s just the same as with hardware Serial except you need to use mySerial, so in setup() you would add:


    and then you can add debug output using mySerial.println(); statements.

    Connect D3 to the RX pin on the FTDI adapter, connect GND between the two and open the a serial monitor on the appropriate port.

    If you don’t have an FTDI adapter an Arduino can be used instead, link the reset and ground pins on it to disable the microcontroller and then connect D3 from the ATtiny to pin 1 on the Arduino and link the grounds as with the adapter.

  • Matthew

    I’ve tried it using a jeenode mk6 and and a UNO by following this image.
    I’ve only managed to get the UNO and the jeenode to comunicate, using some jeelib examples.
    The attiny85 has been quet trixy! I’m at a bit off a loss really. As for the sensors the soldered up identically to yours.
    Would realy appreciate any thoughts!

  • Matthew

    Yea, so I spell like a child!
    I’ve just read my previous post, I struggled to understand what I just said. So I will try again
    I’m running arduino IDE 1.0 something on windows.
    The rx station is an UNO wired up like so
    Running your simple rx sketch
    The tx station is running your dht sketch.
    Both are 868mhz
    I’ve looked through the ports library and everything seems ok, d9&10 turn high every minute on the attiny84 chip.
    If I hook a jeenode mk6 and a UNO as rx and tx station I can play ping/pong and send information back and forth.
    I’ve just upgraded from a cheap ask/ook unit running on an attiny85 using Manchester lib.
    Any ideas would be awesome!
    It’s getting really frustrating. I’m thinking about putting it in the microwave and making a pretty lightening display.

  • chris

    Hi Nathan,

    thank you so much for your excellent support.
    My radios are exactly the same as the one on your image.
    I checked the wiring once again and I am 100% sure that it is all correct.

    I contacted the seller of the radios and he has sent me a modified JeeLib to which he had applied some tweaks quite a while ago and some code which is working for him.
    So far i used the latest JeeLib (downloaded the one where your link leads to).
    I have compared the 2 libs and there are some differences which might cause the problem (I hope).
    No time tonight so I will check it out tomorrow night and let you know the outcome …

    Could you check on your side if there is a problem with the current JeeLib?
    Are you using a tweaked version of the lib?

    Concerning FTDI-debugging:
    As far as I understand the FTDI adapter is just a serial-USB converter. However serial line voltage levels are 5V. Does this work with the low voltage output from the attiny ports running on a 3V battery? Do I need any “special” FTDI adapter or will any cheap one do?

    A comment to the receiving end:
    I am using a RFM12PI from OpenEnergyMonitor to receive the data with my Raspberry PI. I did not install any of their software though as I simply want to receive the data and feed it into fhem instead. I will write my own little program to do this. For a start I just use minicom to communicate with the RFM12PI. The communication works (I can use the commands to set the frequency, group etc. and get the expected respones) but I never receive anything from my sensors (which makes sense as there is no “air traffic” either). Can you tell whether I should see the messages sent from my sensors in minicom as soon as I get them transmitting something?

    Just in case you would like to try minicom on your RFM12PI:
    sudo apt-get install minicom
    minicom -b 9600 -o -D /dev/ttyAMA0


  • Matthew

    Hello Chris,

    I was just reading your post and I don’t know if this might help but has loads of 3v/5v bits and peices on. Along with loads of infomation.
    I bought a cheep one of eBay that also had a isp thing on it, which worked well with an attiny 85.
    Hope this might help.

  • Chris, I wasn’t on the latest JeeLib but have updated it and tried again and it still works so don’t think that is the problem.

    With the FTDI adapter you will be OK as long as you aren’t powering the TinyTX from it, just connect the serial and the ground only.

    It has been a while since I’ve used the RFM12PI but you should definitely see messages in Minicom if it is receiving something.

    Matthew, Looks like your problem could be on the sensor side, can you try this test sketch on the transmitter, it should send an incrementing number and the battery voltage every 10 seconds. If that works at least it will narrow it down a bit.

  • Nick Lupien (@chalupien on Twitter)

    Hello, So I have 2 of these tinytx3 to test and the IC clip and USB ASP programmer and I keep getting the same errors… I’ve checked the connections over and over and over again. OSX and Arduino program.

    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: usbasp_transmit: usb_control_msg(DeviceRequestTO): unknown error
    avrdude: error: programm enable: target doesn’t answer. 0
    avrdude: initialization failed, rc=-1
    Double check connections and try again, or use -F to override
    this check.

  • Nathan, magnificent job on those TinyTX boards! I am working more or less in the same direction with low power sensor nodes, any chance of you updating the tinyTX board anytime in the future to have it accept an nrf24l01 module by default (in stead of cutting the traces)?

    I have been dabbling with Eagle for some time, but it takes me *ages* to get something working (and I’ve never ever had a pcb made where I haven;t discovered faults after receiving them)

  • Nick, This seems to be the important part although it’s not very helpful:

    avrdude: error: usbasp_transmit: usb_control_msg(DeviceRequestTO): unknown error

    The “cannot set sck period” warning is normal and the rest is just saying it can’t communicate with the ATtiny84, due to the above problem.

    I found this related to a similar device which suggests it could be a problem when using a USB 3 port and that putting a USB 2 hub in between might solve it:

    M.M. Thanks, No plans at the moment but never say never!

  • Hi, saw the same answer on some other threads just now. Apologes for double-posting.
    Brushing up my eagle skills now, when finished will share.

  • chris

    I finally found out what my problem was.

    There a nasty setting in the jeelib RF12M initialization which sets the battery threshold comparator to 3.1V and allows battery low interrupts. When running on batteries A small dip in supply voltage (transmission running) is enough to trip the threshold and lockup the transmit state machine.

    so changing
    rf12_xfer(0xC049); // 1.66MHz,3.1V
    rf12_xfer(0xC040); // 1.66MHz,2.2V

    in rf12.cpp solved my problem.

    Hope this might help others trying to run on batteries too …


  • Interesting, I wonder why that hasn’t come up before, all mine are running off 2xAA or 2xAAA and I haven’t changed that.

    You can also set the low battery detect in the sketch by adding rf12_control(0xC040); after the rf12_initialize command, saves messing with the library.

  • John Slee (@indigoid on Twitter)

    1.2-1.3v NiCd/NiMH/etc vs. 1.5v alkaline perhaps? Chris, what kind of batteries are you using? Nathan I assume you are using alkaline?

    You’re not going to get 3v from a pair of rechargeable AA/AAA…

  • Yes, I’m using alkaline here but I have lots that are well below 3.1V and never seen that problem. It depends on the sensor but they seem to be good down to around 2.6V with a DS18B20 where the sensor starts giving incorrect readings. Will be doing a brief blog post on that later as today marks the 2 year anniversary of the sensor I’ve had running the longest on the same pair of AA batteries, now at 2.71V.

  • John

    Do you have any plans to layout the TinyTX board to take the RFM69HW device?

  • Not right now but I have got a couple of the RFM69CW (RFM12B footprint compatible version of the standard RFM69W) that I’m trying out. Tested so far with the lowpowerlab fork of the Jeelib library but I believe JCW from JeeLabs is working on his own version so hanging on to see where that goes at the moment.

  • Can

    Hi Nathan,

    hopefully you have a clou, because i do not have any…

    I’ve build some tinytx2 and i can recieve data on an arduino and also on a nanoderf. But it happens, that i do not recieve anything for days and then i recieve 5 messages in a row (this is because of the ack as you mentioned). But why do i have this long time between the data. Even if i unplug the battereies and put it back i do not always recieve data from the tinytx.

    What can i do about this problem?

  • chris

    Nathan you are right.
    The setting rf12_control(0xC040); was not the problem (at least not the only one).
    After I changed this the code never got stuck any more which it did many times before the change. However the units are still extremely unreliable. Sometimes it works, sometimes it doesn’t. For a while I thought it is becaus the soldering of the RFM12B to the tinytx PCB gets wekk after a while. At least I seemed to have sussess a couple of times by re-heating the connections. My test board was working fine for quite a while and I was receiving correct messages with my Raspberry PI. However for an unknown reason it is not working any more and re-heating several times did not change anythin this time.
    I am clse to desperation right now. My test code is obviously working without getting stuck as I can tell from the LED blink codes. But the unit is not sending again and I do not have any idea why. How are you soldering the RFM12B?

  • Domanic

    Hello Nathan, very cool sight champ, and well done, I’m looking at, well requiring several wirless temp units and an receiver to moniter temps in a variety of locations, can this be done with your system you help is greatly appreciated, I’m not an electronic wiz by any means

  • Skem


    I’m working with the TinyTX3, for water-flow Measurement. I want to save power on my setup (using SLEEP_MODE_PWR_DOWN) , but in that case I need the flow-sensor to be my “External interrupt” to give the WakeUp-signal. I can’t use INT0 for WakeUp, be course it’s already used by the RFM12B.

    My question is …
    - Is it possible to use the RFM12B module, ex. Pulse on nINT pin ?
    - Do I need to give the attiny84A a RESET pulse to WakeUp ?
    - Do you have any idea/example on using external interrupt on your Tinytx3 ?

  • chris

    Hi Nathan,

    I finally got my multi-sensor project working with a stable RF link.
    The problem I had seems to have been a soldering problem when connecting the RFM12B to the tinytx PCB. I reduced the heat of the soldering iron from 400 to 300°C and used less solder.
    This seems to have solved my problem. At first I had 1 unit not working at all then I built another one which was working sometimes (randomly). Now I have built 2 more units with my new soldering technique which are sending reliably.

    I wrote a program which handles the PIR sensor and the reed switch by pin change interrupts and the temperature, humidity and LDR light sensor by watchdog timer interrupt.

    The remaining problem I have is that the PIR sensors are not working correctly when the data pin is connected to the PCB. I use digital pin 3. If the pin is not connected then the PIR sensor works just fine (as I can tell easily using a voltmeter attached to the data pin). However if I connect the data pin to the digital input then the PIR sensor switches between high and low every few seconds.

    I measured ~1.3V on the digital pin 3 permanently. Is this normal? Does anybody know whether this may cause the PIR sensor to go crazy? If so – how can I avoid this?

    I already tried both activating and deactivating the internal pullup resistor. No success.

    Does anybody have any ideas?



  • casper

    First of all. Nice project!

    Is it correct that the connection is unencrypted.
    Anyone could read the data and even change?

    Is there a way to prevent or at least impede this?

    Thanks so much Nathan!

  • casper

    What I’ve forgotten. I mean the encryption of a reed switch.
    There is just the nodeID and the staus 1 or 0.

  • Pitto

    Hi there!

    Thanks for the lovely instructions and ideas…

    All I miss is a little antenna information:
    Where can I buy it?

    Should I make one? How?

    Thanks a lot for all the precious information here :)

  • Nick Lupien (@chalupien on Twitter)

    Hi When programming the TinyTx3 do I need to have the VCC and GND hooked up to a 3.3v supply? I tried to just hook up the USB AVR and test clips to the AT84PU and Im not getting anywhere.

  • Nick Lupien (@chalupien on Twitter)

    Hello, I am still stuck on programming the ATTINY84. I have a module soldered together and wired up the IC Test clip and the AVR USB programmer correctly from the diagrams (I THINK) But I am unable to load any sketches to the chip. I have read through Nathan’s write up over an over but I must be missing something. Anyone have any ideas?

  • James Roberts

    @chris – Sounds like we’re working on a similar project – I’m working with a friend to something very similar – temp, light and a PIR. We’ve had a problem with PIR’s too, we think it’s down to the pir we’re using need 5v, even though the level output pin is 3.3v…. We’re still investigating, but which PIR are you using – we have one of these –

    (Breadboard at the moment, tinytx’s on order, but maybe incorrectly ordered :( )


  • chris

    I am useing the same PIR sensors.
    I have them working fine now. Simply connect 3.3V to the pin of the header where the jumper is (the pin which is not covered by the jumper on the images). Do not connect the normally used VCC pin. That bypasses the voltage converter and lets the sensor work happily with 3.3V.

    Let me know if it is working!


  • James Roberts

    Thanks Chris – having checked, mine hasn’t got the yellow jumper, but I’ll get some of those ordered now I know they work. Thanks again.

  • chris

    @James: Mine have no jumper either but there are solder pads at the same position. I soldered the wire directly to the pad.

  • Jon

    @Chris Thanks, managed to get my PIR sensors working at 3v by soldering that pad.

    Im still having problems with the code though (the values its reading are wrong), could you post a copy of yours?


  • Priit

    Do you also have code that uses Arduino Ethernet Shield?

  • Nick Lupien (@chalupien on Twitter)

    Hello, I am still stuck on programming the ATTINY84. I have a module soldered together and wired up the IC Test clip and the AVR USB programmer correctly from the diagrams (I THINK) But I am unable to load the bootloader or any sketches to the chip. Anyone have any ideas?

    LINK to what my setup looks like

  • Bryce O

    First time posting, but I’d like to shout out to everyone for their feedback and input on these pages. I have managed to build and display multiple TinyTX sensors (DS18B20 & DHT22) values through emoncms, but I am trying to increase the period of time between data being sent from the sensor nodes.
    I have been trying different values in last line of the code (let’s use the DS18B20) as an example.

    Sleepy::loseSomeTime(60000); //JeeLabs power save function: enter low power mode for 60 seconds (valid range 16-65000)

    As per the, I have added in the additional line before this last line.

    for (byte i = 0; i < 5; ++i) //repeat the 60 sleep 5 times.

    I have noticed on my emoncms input page that the duration between input readings can vary greatly from 5 to 30 minutes (not the 5 as per the code) which is far greater than the approx. 10% error stated for the watchdog timer. Has anyone else experienced this issue? Does anyone have any suggestions on how to fix this.
    Thanks in advance

  • Jeffrey Herr

    I’m more the programmer and hobbyist type than electronics guru. I’d love a batch of these sensors, but programming chips and making circuit boards just isn’t my thing. Is there anyone willing to cook up a batch of the sensor transmitters for sale?

  • Jeffrey Herr

    There are some interesting looking boards from that are based around the ATTiny85. Looks like it would be easier to program (much, much easier!) and still a reasonable price point for a board. Would this board work pretty much the same as the ATTiny84 that’s referenced for this build?

  • Jeffrey Herr:
    I can prepare a batch for you, how many do you want?
    I only have 6 pcbs at this moment, if you want more it will take approximately 1 month because I need to order more pcbs from seeedstudio..

    Nathan: looks like your TinyTX boards really are becoming very popular :-)

  • Bryce O

    I would like to adapt the TinyTX to monitor and record when my furnace thermostat calls for heat. It is a 24VAC circuit that needs to me monitored and from my understanding an opto isolator could be used to provide a 0 or 1 output signal (on/off). That is about as far as my understanding goes and hope someone could provide some assistance with designing this.

  • Jeffrey Herr

    Bryce, keep me posted, as I have the same need!

  • Jeffrey Herr

    Elio, what would the cost be for a half-dozen? I’m planning to breadboard a couple this weekend, but would love the more clean implementation…

  • Nick (@chalupien on Twitter)

    Ok, So I got an AVR Dragon! I was able to get it to recognize the ATTINY84 chip! I have been struggling with understanding how to program the ino (DHT22) sketch on to the chip. I have AVR Studio installed and made available the JeeLib and DHT22 libraries, but I get all sorts of errors, starting with Ports.h going all the way through the program.

    Anybody get this to happen? I will post what I get when I get a chance to.


  • Bryce O

    I have a dozen of the of the TinyTX up and running the same DS18B20 program with different node Ids, but I find that one node every day that stops sending data. I this is fixed by disconnecting the power of the node for a few minutes and reconnecting. Is there any way of automating this process such as if no ACK is received after 15 minutes or so, reset the whole node?
    I’m still looking for some help with the 24VAC logging mentioned above as well if anyone is interested. Thanks.

  • @Casper No encryption on these at the moment, there isn’t enough space to do it in software and the RFM12B doesn’t have an option to do it in software. The new RFM69CW radio does support hardware encryption and is pin compatible with the RFM12B, the newest Jeelib driver I am using currently only supports the RFM69 in RFM12B compatibility mode at the moment but hopefully encryption will be available before too long. In the meantime you could look at the driver.

    @Pitto The antenna is just a piece of wire cut to the appropriate length, 165mm for 433MHz, 82mm for 868MHz. I use 0.6mm solid core wire.

    @Nick Your connections from the IC clip to USBasp look correct. As you’ve got the Dragon recognising it I wonder if your USBasp is suspect, have you managed to use it for anything else? Reason I say that is I recently stumbled on this page about a clone that didn’t work:
    Now that one isn’t the same as yours but it’s something to consider. Mine is the Baite one pictured at the top of that page by the way, it doesn’t have a nice jumper for the voltage, you need to desolder a “zero ohm” resistor on the bottom to switch it to 3v3.
    Can’t help with the Dragon or AVR Studio I’m afraid, I’ve used neither.

    @Bryce Every time I have seen nodes coming in so infrequently it has been down to poor signal and/or interference, the more nodes you add the worse it tends to get as the weaker nodes lose out if they clash with a stronger signal. Obviously by increasing the interval they will start to disappear for longer if several transmissions get lost. The solution for me was enabling the ACKs and it is now very rare for a sensor to disappear at all.

    @Jeffrey The Jeelib RFM12B library won’t work on the ATtiny85, Martin Harizanov did some work on sending compatible packets here:
    Also check out the Digispark which is another small ATtiny85 board with USB, they even have a RFM12B shield available for it and demo code (which I think is based on Martin’s code).

    @Bryce, Very odd if that node is on the same code and it’s actually a power cycle that brings it back to life. I’ve never experienced anything like that, have you got the two capacitors on it (assuming TinyTX3)? Could you try relocating it temporarily to see if it is getting external interference from something else nearby? I haven’t seen any way to do an automatic reset on the ATtiny like the watchdog reset you can do on the ATMega/Optiboot.
    For your AC detection I don’t have details but you could use an AC optoisolator or maybe a small relay with a 24VAC coil. Maybe someone else can help further.

    PS. Apologies to anyone subscribed to this post by email that has been getting the few spam comments that have slipped through. Generally Akismet does a grand job of keeping them at bay but the blog as been getting hammered recently, Akismet caught 65000 last month and nearly 90000 in December so not surprising if a few slip through. I’ve finally given in and blocked China using IPTABLES as that’s where the vast majority of it comes from, I was reluctant to block an entire region but hopefully it will improve things.

  • Bryce O

    I am using the capacitors on the TinyTX3 boards and have only had one further node stop transmitting. If I simply move the node closer to the base, this does not reconnect the node and a power reset is still required. I’ll play around further with sleep times. I don’t know if emoncms has the ability to send email notifications if a signal has been inactive for a given period of time.
    Thanks for the reply.

  • Reinhard

    Hi Nathan,
    thanks for this great project.
    I build up a TinyTX3 with 868MHz and DHT22 and I use the simple serial receiver sketch running on an Arduino UNO. Transmission of sensor data works perfect but most of the time the sensor repeats sending the data for up to 5 times, so it seems that the ACK is not transmitted/received reliable. This is independent of the distance. The increase of the waiting time for ACK at the sensor didn’t help.
    Do you have any idea?

  • chris


    Make sure that the sender and the receiver are set to the same group. I had a similar problem when I set the group of my base station to zero (receive all). The ACK is sent with group 0 in this case which the sensors (e.g. group 120) do not accept.
    Took me a long time to find out what the problem was …



  • Reinhard

    I just doublechecked the group. I left the sketches unchanged.

    #define MYNODE 30 //node ID of the receiever
    #define freq RF12_868MHZ //frequency
    #define group 210 //network group
    rf12_initialize(MYNODE, freq,group); // Initialise the RFM12B

    #define myNodeID 16 // RF12 node ID in the range 1-30
    #define network 210 // RF12 Network group
    #define freq RF12_868MHZ // Frequency of RFM12B module
    rf12_initialize(myNodeID,freq,network); // Initialize RFM12 with settings defined above

    This should be OK?

  • chris

    OK then you have a different problem. Must be something in your code. I’m afraid I can’t help any further with this.
    You should create a really simple example which tests the ACKs only and play with it until it works. This is how I found my problem in the end.


  • Reinhard

    It was more a problem with the position of the receiver or the antenna. I changed the position of the receiver only a little and ACK is now received properly by the sender. No packet gets lost any more.

  • C W Rose

    Thanks for publishing the board designs. I tried to put an RFM12B on Veroboard about a year ago and it took me twenty minutes of trying to attach bits of wire to burn out one of the pads. (My hands are not what they used to be.) I ordered a batch of the TX3 boards and it took me less than ten minutes to solder up two of them, complete with CPU sockets and bypass caps. I’m sad to see the approaching end of through-pin components; SMT will remain beyond my capabilities.

    BTW, what’s the number sequence (0 3 7 8 9 10) silk screened at the end of the board? I couldn’t find any relationship with any pin sequence, so I took it to be some seekrit code known only to the Illuminati.

    Thanks again – Will

  • @Reinhard It is surprising sometimes how only the smallest difference in position (or antenna position) can make all the difference to reliability of reception. This is one area where using the new RFM69CW instead of a RFM12B on the receive end comes in very useful as you also get an RSSI reading (Received Signal Strength Indication) along with the data which aids in finding the best positioning.

    @Will It was the pain of butchering wires onto the RFM12B that finally spurred me on to learn how to design my own PCBs, I don’t miss that at all! The seekrit code is just the Arduino land equivalent pin numbers, 0 == arduino digital 0, 3 == arduino digital 3 and so on.

  • Jason

    @Nathan – have you had a chance to do any comparisons between the nRF24L01 and the RFM69? There’s a couple of range tests of the RFM69, but no head-to-head comparisons. The difference between how different people do range tests makes it a much more difficult comparison without a direct test.

    With the chip-antenna version of the nRF24L01, I get occasional retries on a wireless sensor node across the street. I’m not sure if it’s signal strength or wifi interference from all the wireless AP’s in the surrounding homes.

  • ltpitt

    Hi all!

    My TinyTX now works perfectly except…

    Just in the same room with the raspberry pi.

    I did my antenna of 165 cm but maybt it is too thin?

    Here’s a pic:

  • ltpitt


    It’s mm and not cm: silly me :)

  • @ltpitt Is it solid core or stranded? I use solid core with a 0.6mm core.

    @Jason I haven’t really done any head to head comparisons with them, the nRF24L01 with the PCB antenna definitely isn’t as good as the RFM12B though.

  • ltpitt


    It’s a silly copper wire :)

    Can you kindly suggest me a link of the product you use?

    I’ve also read about a “rubber duck” antenna: will this work with TinyTX?

    Have a great day!

Leave a Reply




You can use these HTML tags
(links will be automatically marked with rel="nofollow")

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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

By submitting a comment you agree that it can be reproduced under the same licensing terms as the rest of the content on this site.