ATtiny Goes Wireless Schematic Circuit Diagram
In many application areas, it can be very handy to be able to control something wirelessly. This circuit shows how an ATtiny microcontroller can be used to switch an appliance on and off remotely with a little help from wireless transmitter and receiver modules available from Conrad Electronic. If needed, it is very easy to extend the project to include additional commands. To demonstrate the principle of operation we represent the appliance to be controlled by a red LED at the receiver end. At the transmitter end, buttons S1 and S2 are responsible for the ‘on’ and ‘off’ switching functions (see left-hand circuit diagram).
When one of these buttons is pressed it pulls the corresponding input of the microcontroller (PD3 or PD4) to ground. The software running in the microcontroller recognizes the input and converts it into a command message. In this case, the message consists of the single character ‘E’ to switch the appliance on and ‘A’ to switch it off. The command message is emitted at output PD1 (TXD) of the ATtiny, where it is inverted by T1 and then sent to the Conrad transmitter module. The inverter is needed here as the TXD output (as is conventional) returns high when no message is being sent. Without the inverter, this would mean that the transmitter would always be active when no message was being sent: with the arrangement shown the transmitter is idle between messages. Crystal X1 produces the clock for the microcontroller, the 3.6864 MHz frequency used allowing easy generation of baud rates from 9600 baud to 76800 baud. We configure the microcontroller to run at 9600 baud, which gives reliable operation with the radio modules. LED D1 and its series resistor are present in the circuit to give feedback to the user when the microcontroller registers an input. The LED lights when either of the buttons is pressed. At the receiver end (see right-hand circuit diagram) the signal from the receiver module is passed to another microcontroller which then processes the received information. Because the signal was inverted prior to transmission, it must be returned to its uninverted form by inverter T1. The software in the microcontroller reads the signal in at its PD0 (RXD) input. Depending on whether its sees the letter ‘E’ or ‘A’, it turns LED D1 on or off. Again, the microcontroller receives its clock from crystal X1, with a frequency of 3.6864 MHz.
The 433 MHz radio transmitter and receiver modules used in this project are available as a set from Conrad [1]. Construction is relatively straightforward. It is worth noting that the antennas on the transmitter and receiver modules are tuned appropriately at the factory and should not need further adjustment. The circuit can conveniently be built on an Elektor Universal Prototyping Board Size-1 (UPBS-1, a.k.a.ELEX-1) cut into two halves (see photographs and mounting plans). The author managed to achieve reliable communication between the two modules within his house over a distance of 12 m (40 ft).
Internet Link:
[1] www.conrad-uk.com/ce/en/
product/130428/