TinyTX Wireless Sensor

The 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.

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 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 Circuits.io 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:

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

To use an ISP programmer connect as follows:

Programmer

ATtiny84

SCK

Pin 9

MISO

Pin 8

MOSI

Pin 7

RESET

Pin 4

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

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.

Troubleshooting

A couple of things have frequently cropped up in the comments below:

“error: ‘Serial’ was not declared in this scope” when compiling.

Make sure you are using the arduino-tiny core from here and not the “damellis” one on github which is linked from the mit.edu pages as that will cause the above error.

Error containing “relocation truncated to fit: R_AVR_13_PCREL”

This is an issue with the “ld” executable supplied with the Windows and Mac versions of the Arduino IDE (Linux is fine) that shows up if the file size is over 4KB. You can get replacement versions of ld here that will fix this.

Cases

For some of my nodes I’ve just used a double sided sticky pad to stick the board to the battery holder but others have been cased in small ABS boxes, typically this one or the larger but more attractive and purpose designed cases from Evatron, usually the EN30W sensor case pictured below (also available from Bitsbox here) or the PP42M.

On the receiving end

OSWIN Open Source Wireless IoT Node

As detailed here I’m now using one of my Tiny328 boards with an FTDI adapter plugged into my server and using Node-RED to upload to emoncms. Prior to this I used one my OSWIN boards as a gateway, this is my own design for an ATmega1284P based Arduino compatible, prior to that I used a prototype MAX1284 gateway and before that I used a Nanode. In all cases the data is fed into my local 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 Joggleremoncms multigraphWiNode based GLCD with RGB backlight and touchscreen

Qty: Up to you but note that the price for 5 and 10 is the same so 10 is the sensible minimum. Sometimes you will get one or two more free as well.PCB Layer: 2PCB Thickness: 1.6mmPCB Dimension: 5cm Max*5cm MaxPCB Colour: Your choice, anything other than green is extra.Surface Finish: This is the finish on the pads, I use HASL, you can choose lead free HASL for an extra 5 USD if you like or ENIG (gold plated) if you are feeling flush.

Share this:

279 thoughts on “TinyTX Wireless Sensor”

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

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.

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.

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.

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.,
Samples:
…/JeeLib/JeeLib.h:7,
from TinyTX_DS18B20.cpp:16:
or
../Ports.h:447: error: conflicting return type specified for ‘virtual void UartPlug::write(byte)’

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.

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!

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!
:O)

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 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.

Hello
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).

Hi… I use Raspberry PI with RFM12Pi end emoncms. You can see here… http://emoncms.paci.name/pacaj2am . 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:

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: https://github.com/nathanchantrell/emonextras/blob/master/csv.php
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

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?

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?

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?

@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.

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.

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: http://www.flickr.com/photos/nathanchantrell/8634475735/ (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 http://shop.ciseco.co.uk/rf-module-range/

Hi,
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?

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 ?

@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 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.

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

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… https://www.sparkfun.com/products/11028 . 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.

@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.

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 ?

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.

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
src/TinyTX_RX_Simple.cpp
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

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.”

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.

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, 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 http://harizanov.com/2013/07/flood-alarm/). Any thoughts on this Nathan?

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.

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 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.

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.

hi,
ive been messing around with some of your TinyTX3 from circuits.io.
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?

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! 🙂

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.

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
}

@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.

@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.

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?

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:
mySerial.begin(9600);

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.

Hi,
I’ve tried it using a jeenode mk6 and and a UNO by following this image.http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless
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!

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 sohttp://openenergymonitor.org/emon/sites/default/files/Cookbook_RFM12B_connections.png
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.

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

I was just reading your post and I don’t know if this might help but jeelib.com has loads of 3v/5v bits and peices on. Along with loads of infomation.http://jeelabs.com/products/usb-bub
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.
Regards
Matthew

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.

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)

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.

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.

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.

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.

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?

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
Thanks

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 ?

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.

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:
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.

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?

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.

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

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?

There are some interesting looking boards from AdaFruit.com 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?http://www.adafruit.com/products/1500

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 🙂

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.

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.

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 http://lowpowerlab.com/ 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: http://wiki.efihacks.com/index.php?title=USBasp_Experiences
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: http://harizanov.com/2012/06/experimenting-with-attiny85-rfm12b/
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.

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.

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?

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:
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.

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.

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.

@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.

@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.

Hi Nathan,
I found sth confusing what I don’t understand. On the TinyTx the ATTiny MOSI signal is connected to SDO of the RFM12B (MISO to SDI). On other boards like the RFM12PI board MOSI of the ATMega328 is connected to SDI (MISO to SDO). I got both versions working with the same library. That’s really confusing to me. Can you explain that?
Regard Reinhard

Dear Nathan,
first of all thanks for your excellent suggestions, comments and your help in building this system.
I do have hopefully a not too silly question: is it possible to use one tinytx board installed in raspberry pi for sending and receiving signals?

Thanks for this! I’m wondering if I can modify it a bit to work with the popular NRF24L01+ radio (cheaper, easier to use on RPI as rx). It’s a shame about the voltage limit, a LiPo is almost perfect for it. Seems like the ideal voltage is somewhere in between 2 x AA and a LiPo.

Hi Walter, Really not necessary but if you click the “hamburger button” in the top right corner I’ve added a PayPal donate button there alongside the Flattr one. All donations gratefully received 🙂
Cheers,
Nathan

@sica – Chris’ problem turned out to be an issue with soldering of the RFM12B I think, have you tried resoldering? I can’t think of any other reason it would stick there given everthing else is the same.

Hi Nathan,
I just wanted to say thank you for publishing this. I went to build some, but had trouble finding the radios in stock over here in the US. I did find one backordered place, but in the process found the nRF24L01+. The info you shared inspired me to build my own based on that board, and it seems to be working well so far. You can see the details at electron14.com, and I’m sharing my work-in-progress in github as well.

I do have some of your tinytx boards printed and ready to go, if anyone can get the compatible radios and wants them I’ll be happy to ship them if you send me a shipping label. I can be reached via my website.

i’ve try to found the RFM12B module but it’s pretty difficult. where i can found ones or a similar chip ?
have you try to double sensor on one board (LDR+DHT22) for example, if it’s not harmering too much the batt ?

Hi All,
I’m working on replacing the RFM12b with the new RFM69cw on my TinyTX board. .. Have anyone get that to work ? ..
Do I have to change the H/W setup, ex. add PullUp resistor, etc. ?
I use Arduino (USBasp) to program, and have update to new Jeelib library. But it’s not working, looks like the Attiny84 are hanging ..
If I switch back to RFM12b, it’s working fine

i will like to purchase water leak detector from your company.Can i have a link that will take me directly to the types of water leak detector that you carry with the prices attached to it.What types of payment do you accept?

But I still have to make change to the TinyTX Hardware. I can’t get it to work without insert a PullUp resistor (10K) to RFM69CW pin-9 (NSS).
After then it’s working my Programmer (USBasp v2.0), and it seems to communicate OK to my Raspberry-PI (RFM2PI) ..

hi Nathan,
thanks for the project. I’m an absolute beginner but with help from this page i got 3 TinyTx3 (+DHT22) with the RFM12B running.
A RFM12pi is working as the receiver. Since i got a couple of spare TinyTx PCBs i decided to build some more sensors with the RFM69CW, as far as i understand that should be possible.
I added the line “#define RF69_COMPAT 1” before the JeeLib.h but the Pi isn’t receiving any data from the RFM69CW boards. Do i have to change anything else?
The JeeLib Library is up to date.

To check if “#define RF69_COMPAT 1” is working i flashed one of my running TinyTx3(RFM12B) with
your DHT22 code and added the line “”#define RF69_COMPAT 0” – working!

RFM69CW with “#define RF69_COMPAT 1” – not working, SendTest and the DHT22 code

I’ve had some boards made (which arrived today!) and have started some testing.

I’ve wired up a TinyTX on a breadboard with a DHT22 and flashed the code for it (with bootloader for 8Mhz) and I think it’s transmitting ok. When I ran the program with a LED flash it certainly flashed every minute.

On to the receiver. I’m at a slight loss here. I’ve read lots of your pages and comments but I’m not sure on a few things.

1. The node ID. Is it used for anything to do with the communications or just a way to identify which node has sent a reading?
2. I’ve run the serial code from Jeelib and all I get is 12 every so often but I’ve no idea if that’s valid data or something else entirely. Here is the output after the first time it receives data.
[rf12serial] _ i31 g210 @ 868 MHz x2
12
Is this correct?
This then leads me onto my next issue…
3. Each program has a data block but how does the receiving end know what to do with each packet it (eventually) receives? Or is the receiving arduino just to get the data and pass it onto the pc/Raspberry Pi etc?

q1: It is used when the node transmits or received a directed packet )non broadcast).
q2: Try using RF12Demo.cpp
q3: It depends what you want to happen, the sensor reports back to RF12Demo which could connect to the RasPi for it to collect and graph sensor data.

#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

//########################################################################################################################
//Data Structure to be sent
//########################################################################################################################

Very good sensor! But I have problems making one 🙁 I did one and didn’t work. I resoldered it again, since I’m quite new at this, with the same results. I made another one, with new components, and I have exactly the same problems:
First, with batteries the attiny doesn’t even work (I have debugged it using TinyDebugSerial). With Arduino 3.3V power it works.
Second, it only emits one zero (0)! I’ve checked it using a circuit I made to record 433Mhz signals through the line in of my computer. That circuit works very well (I’ve tried it with other 433Mhz remotes) but with my two TinyTx I register just one pulse. I’ve changed the code to emit a fixed number with same results. I’m afraid the RFM12B I’ve purchased (on ebay, it says product name HYRM12B). Could someone tell me if that component should work? (I’m not sure if I should link nothing here, so just google RF HYRM12B and take the first result). Thanks in advance!
P.S. Sorry if here is not the place to ask things like this. If so, please tell me where should I go…

I ordered 10 of your TinyTx3 boards from Seeed Fusion and received 24. Nice return on investment! I can’t wait to get my sensor network up and running. Thanks for the project and great documentation. -E

Hi Nathan,
since more than 6 month I have 3 TinyTX with DHT22 running. One of these sensors doesn’t work very reliable and a short time ago it stopped sending any data. After a long time of troubleshooting I found that the (switched) power for the DHT out of the ATTiny84 PIN is nearly 0,7V lower than the supply voltage. I saw this with 2 ATTiny84. The problem for this special DHT22 was that it doesn’t work at less than 3.2V.
Did you experience something like this before?
I am now powering the DHT directly from the supply voltage. With 40-50uA standby current it should be acceptable.
Today I have a diode in series to reduce the voltage of a LiIon rechargeable battery giving a supply voltage of 3.1V to 3.8V, depending of the charge status. This is because the RFM12B should be operated at 2.2-3.8V. I think I’ll give it a try without diode. Do you think the RFM12B will get damaged?
Maybe a solution would be to power the RFM12B out of an output pin of the ATTiny?
Greetings from Cologne, Reinhard

Troubleshooting – A couple of things have frequently cropped up in the comments below:
“error: ‘Serial’ was not declared in this scope” when compiling.
———————————————————

User “casestudies” mentioned this Problem first in this blog on October 4, 2013 at 12:22 pm. Since the same Problem now happended again during compiling an ATtiny84A-PU on my Windows 7/64 Bit PC with Arduino IDE, i try herewith again to get any help for getting my TinyTX running with the JeeLib Library.
I tried Arduino 1.0.5/1.0.6/1.6.1 with all possible/mentioned ATtiny Libraries without success. The IDE stops with the Error-Message:

Hey Nathan,
I’m running your TinyTX v2 and have been for a while with the Raspberry Pi OEM Gateway perfectly fine.
I’ve now got a JeeNove v5 USB for my gateway and I am getting some really odd data received (the Node ID is x+32, for example). Do you have any ideas what would be causing this on either end, or how to debug it?
Thanks heaps,
Nate

Here’s is the map I got using the Blinky sketch.
Below shows map of pin numbers used in Ardunio Sketch to silk screen print on TinyTXv3 board.
If this appears somewhere – apologies – I could’nt find it so thought to post it up

Thanks 🙂 One of the cores produces the pin numbers back to front – may be just for fun 🙂 – because that is empirical data measured after changing the sketch pin number form 1 through to 10 then putting a LED on the TinyTXv3 board slikscreen printed numbers. I can’t tell you which one as narrowing down the parameters to get the set-up working took and while and I didn’t write it down.

Hello Nathan! I am very excited to get some of these TinyTX sensors up and running. I have been working in building automation for about 18 years and this may turn out to really help us out. We have been trying to find some cost effective wireless temp sensors for some time now.
Anyway, I am having issues with programming the ATTiny 84 with my arduino. The ISP sketch loads fine into my arduino – it says done uploading and LED13 stops blinking (stays on constantly). Then I set the board to “ATtiny84 @ 8 ….”, set the programmer to “Arduino as ISP”. Then I select “Burn Bootloader”. It does say “done burning bootloader” but I get four of the error messages you said could be ignored. I think the chip is setup at this point.
The problem comes when I try to send the TinyTx DS18B20 sketch to the ATtiny84. I leave the IDE set to the ATtiny84 board, leave the programmer set to “Arduino as ISP”, load the TinyTX_DS18B20 sketch from your Github and do a compile. I get this error:
In file included from TinyTX_DS18B20.ino:14:
C:\Program Files (x86)\Arduino\libraries\OneWire/OneWire.h:8:10: error: #include expects “FILENAME” or
I made the change to “OneWire.h” like you said on your website where we were to insert the line of text. If I comment out that line of text I get a hole bunch of errors.
Not sure what to do. I am using Arduino IDE 1.0.6
Thanks!

Hello Nathan. Thanks for the suggestion, I just figured that out late last night! I am having some more issues though. The DS18B20 sketch does not seem to compile. I get a missing file error for “avr-g++” or something. I am not at the correct PC right now to copy the entire error. I am running Arduino IDE 1.6.6 and using the ATtiny core v1.5 that you suggest. Using the damellis cores, I was able to successfully load the “blink” sketch to my ATtiny 84 and have it blink one of the pins. Of course this core gives me the “serial” error when I try to load the DS18B20 sketch. What versions of Arduino, ATtiny cores, JeeLib, OneWire, etc do you know all work together. I am so excited to finally get this to work! These problems are so frustrating. Props to you! Figuring this all out in the first place must have taken forever!

I’ve been using 1.6.5 but I did have to make a couple of changes in the tiny core files as platform.txt in the arduino-tiny core files was pointing to the wrong location for the avrdude binary and conf file.

I’m using Linux so not sure if you will have the same problem on Windows, if it complains about not finding avrdude check the following lines in platform.txt are pointing to the correct locations:
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf

For any Linux users who might read this in the future it is the two lines below those that need changing to the following:
tools.avrdude.cmd.path.linux={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path.linux={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf

There was also a problem with the SoftwareSerial library not being found as they moved it to hardware/arduino/avr/libraries/SoftwareSerial/ so it won’t be found by the tiny core. You will need to copy that to hardware/tiny/avr/libraries/SoftwareSerial/

If you are really struggling then the 1.0 version of the arduino-tiny core always worked out of the box on the older 1.0.x series of the Arduino IDE and that is what I would have been using when I first went through all this.

Hello again. I was getting thwarted at every turn. I tried IDE v1.x, 1.5x, 1.6x and they all would give me different errors at different places. I figured there must be something else going on, something more than just a setting or something. I then realized that this is the first Arduino work that I have done on my new Win 10 PC. I moved back to my old PC that has Win 7 on it and the older 1.5.4 IDE. I installed the 1.5 tiny core and the required libraries and the sketch compiled right away! (after the platform.txt fix that is). I managed to get my tiny 84 programmed with the DS18B20 sketch and plugged it into my TinyTX board. I used the wiring drawing found at http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless and wired an RFM12b to my Uno. I loaded it with the TinyTX_RX_Simple sketch. When it was running, I opened the serial monitor and it gave me the waiting for data message. I waited for 5-10 minutes and nothing. I figured I did not know for sure if the TinyTX was actually transmitting so I wired an LED to its PIN7 and put a couple lines of code into blink it whenever the rfwrite() routine runs. This seemed to work but the timing is way off. I changed that last line of the program to sleep for 10000ms but the LED blinks only every 35-40 sec. Still no receive on the Uno side. It then tried your TinyTX_SendTest sketch and added the LED as well. Still nothing!

Is the JeeLib library different now since when you did most of the work on the TinyTX? I saw a sketch from Openenergymonitor called TX_SimpleRFM12B_demo and there is a line in it that yours does not have:
#define RF69_COMPAT 0 //Set to 1 if using RFM69CW or 0 is using RFM12B
Do I need to add this to my sketches?
Also, one time I got a compile error for this line in the TX sketch:
#define freq RF12_433MHZ //frequency
The openenergymonitor sketch has “#define RF_freq…”. The strange thing is that I only got the compile error for that once and then it went away.
Any idea on those two items?

OK, so I am back from some busy times at work! It was actually good because I got to get a fresh start kind of. I decided to make a new breadborad layout for my receiver radio to arduino interface. As soon as I turned this one on BOOM, I was getting data! It turns out the radio I was using on the arduino end was no good. Wow, that was frustrating. Now I have a couple TinyTXs running. I do seem to have a problem with them freezing up every once and a while. Not sure what that is about. I am going to try slowing them down, they are updating at 5 sec right now. Have you ever had problems with them locking up after working fine on a shelf for 5-10 hours? All I do is cycle power and they are up and running fine again.
Thanks,

Thanks for your reply.
I have now different versions from Arduino installed.
1.6.8
1.5
1.0.6
I have varius versions ov jeelib and hardware definitions.
nothing works.
i am so angry about the money i have spend in this project.
i only want to send some data to my emoncms. and the boards make problems and the librarys also.
write code is far away 8-(

Is there a trick for the gerber export? I’ve modified the board to suit my needs but I can not get the gerber export working properly. Even when I am using nathan’s original eagle files to export gerber files, they look completely different from the gerber files nathan is providing. Any ideas?

Hello, build a 6 sensors with DHT22 a few years ago but the dht is lacking accuracy in humidity, so i want to switch to bosch bme280. Is it possible with the boads design above, respectively with the attiny84?

Unfortunately I have one issue left:
I’m using RFM69CW Modules with the #define RF69_COMPAT 1 line.
The first transmission is flawless, but then it seems to lock up – no subsequent transmissions follow.
I have to turn power off and on to get the next transmission.