Sunday, February 2, 2014

Trinket-izing the 434Mhz RF Transmitter


434MHz RF Transmitter with the Trinket
The transmitter side of the 434mhz RF Transmitter/Receiver with the Arduino Micro  doesn't really do much processing. It doesn't really need all of the functionally of the Arduino Micro just to collect a little temperature reading and send it the RF Transmitter! The Adafruit Trinket has plenty of power and space for the processing needed, with the added benefit that it shrinks the size and the cost of the project!

Parts List


Temperature Sensor and RF Transmitter:
RF Link Transmitter - 434MHz ($3.95)
Adafruit Trinket 3V Logic   ( $7.95)

Total Cost  $14

Click here to get the code for this project ...

Serial Communications on the Trinket
The Trinket doesn't have is a serial interface like most Arduino boards have. Fortunately there are ways around it! With a little research, I found there are three main methods being used to get serial communications with the Trinket:

  1. Use Virtual Wire to simulate it. I tried a couple of versions of this but I could not get this to compile. Some people also seem to write their own implementation of this.
  2. Use Software Serial to turn a couple of pins into an RX/TX. The plus side of this is that it works! The downside is that it takes a lot of memory so you may not have much room left for other stuff if you use this. Pulling in the Software Serial put the size of the Transmitter/Temperature reading sketch up to 5,058 bytes, which still fits on the Trinket!
  3. Another option - use the UsiSerial library posted by Frank Zhao to implement a hardware serial port. The upside of this is a much smaller foot print! Using the UsiSerial, my compiled sketch is only 3,666 bytes! Plenty of room left! Unfortunately, while this compiled and loaded, it didn't work. Maybe because I am using the 3 Volt Trinket? The notes say it was tested on the 16MHz trinket which I believe is the one with 5 Volt Logic.

Circuit Setup


434MHz RF Transmitter Connections:
GND  -> Ground on Trinket
DataIn -> Software Serial TX pin 1 on Trinket
Vcc     -> 3V from Trinket
ANT   -> 13 cm wire used as an antenna

TMP36 Connections:
Vcc  -> 3.3V on Trinket (TMP36 Pin 1 on left when looking at flat side of sensor)
Vout -> Pin 2/AnalogRead(1) on Trinket (TMP36 Center Pin)
Gnd  -> Ground on Trinket (TMP36 Pin 3 on right when looking at flat side of sensor)


Trinket Transmitter Temperature Sensor Circuit