Digispark Controls Relay Via GSM
by Patxipt in Circuits > Arduino
1795 Views, 6 Favorites, 0 Comments
Digispark Controls Relay Via GSM
This instructable uses a Digispark board, together with a relay and GSM module to turn on or off and appliance, while texting the current state to a predefined phone number(s).
The code is very crude, responsive to any communication from the module to the Digispark (includes a phone call, text message, anything that triggers a communication).
It automatically hangs up roughly after 4 dialing tones, in case of a phone call.
Setting Up
This project involves the following:
- 1 Digispark module using an ATtiny85 AVR MCU;
- 1 A6 GSM module with valid SIM card;
- 1 5V relay module
- Some wires;
- A box to put this in to (I'm still missing this);
- Something to turn on or off!
Connections and Programming
The software I wrote uses pin 0 for actuating the relay, pin 2 as serial receive and pin 3 as serial transmit.
As the Digispark has no UART, we are using SoftwareSerial library.
Pin 0 is connected to the relay board's input (I mounted my Digispark via headers to the relay board), Pin 2 connects to the GSM module's Tx pin and Pin 3 connects to the GSM module's Rx pin.
I chose pin 3 as Tx as it already has a 3.4V zener clamping diode for USB communication/programming, while the GSM module uses 2.8V logic, according to the datasheet. I haven't had any issues until now, since communication is set to a minimum.
5V and ground are taken from the GSM board.
Downloads
Ready to Use!
Program the Digispark with the included code, not forgetting to replace "xxxxxx" and "yyyyyy" with you recipient's phone number.
Connect a lamp or other load under 10A to the relay, dial the GSM module phone number and you'll be presented with a clicking sound and an SMS indicating if the relay is On or Off!