Martin's corner on the web

Experimenting with ATtiny85 + RFM12B

I have been experimenting these days with an ATTiny85 and trying to get it work with RFM12B. The inspiration mostly came from this post,  the guy built a remote sensor unit with an ATTiny45, a SHT11 sensor, and a RFM12B 868 MHz transceiver module. I was tempted because the project uses one of the smallest of Amtel’s MCUs and that’s quite appealing solution for a low power, small sized cheap remote sensor.

Another interesting fact that has kept many away from the ATTiny85 is the limited pins that are available. With hacking in mind though, you will find that this may not be an issue at all.. The MOSI and SCK are available when the RFM12B is not selected, so one could briefly put these pins in input mode and read connected sensor through a 10 kΩ resistor, then change them to output pins while communicating with the RFM12B.  There are RFM12b library implementations that do not use interrupts, but rather status polling, so that is a pin saver as well. Note that the idea of a remote sensor is that it will send data and not receive, therefore we don’t really need to worry about polling for receiving.. Finally, the RESET pin can be configured to work as a regular I/O pin through fuses, thought the cost is losing ability to program the ATTiny with a regular ISP (anyway good solution for pretty much matured projects). Overall with different techniques you can have a whopping four pins for whatever you need: analog sensors, one-wire sensors, bit-banged I2C and so forth.

So, as a first step I want to get the Attiny+RFM12B hardware part working then gradually interfacing with various sensors. Here is my current setup:

..and the schematic materialized into this:

..the LED is to see it is alive (and it is 🙂 )

To get started with the hardware, I wanted to first test that setup with the working code as per the project mentioned in the beginning. With small modifications on the initialization of the RFM12B, I was able to get it running and I was able to pick up the transmissions with a JeeNode v6 running the RFM12 demo sketch:

The packets have different format from Jeelib’s, so they are received as “bad”, that can easily be fixed I assume. It was important just to see that the ATtiny and the RFM are talking OK and the hardware part is fine. The code uses RFM polling and not interrupts. Note that this example uses AVR/GCC stuff and is not quite easy for the unexperienced (like me). My intention is to port the JeeLib to work with the ’85s usin the pin change interrupts. I have made the first steps, but have come to a dead end.

I will keep trying, in the mean time I started new forum threads here and here, so if you can contribute – please do so.

One thought on “Experimenting with ATtiny85 + RFM12B

  1. Pingback: Sending Jeelib compatible packets with Attiny85+RFM12b | Martin's corner on the web