- How to Adjust X and Y Axis Scale in Arduino Serial Plotter (No Extra Software Needed)Posted 2 months ago
- Elettronici Entusiasti: Inspiring Makers at Maker Faire Rome 2024Posted 2 months ago
- makeITcircular 2024 content launched – Part of Maker Faire Rome 2024Posted 5 months ago
- Application For Maker Faire Rome 2024: Deadline June 20thPosted 6 months ago
- Building a 3D Digital Clock with ArduinoPosted 11 months ago
- Creating a controller for Minecraft with realistic body movements using ArduinoPosted 12 months ago
- Snowflake with ArduinoPosted 12 months ago
- Holographic Christmas TreePosted 1 year ago
- Segstick: Build Your Own Self-Balancing Vehicle in Just 2 Days with ArduinoPosted 1 year ago
- ZSWatch: An Open-Source Smartwatch Project Based on the Zephyr Operating SystemPosted 1 year ago
Garden lights and antitheft control with Arduino via bluetooth
We present the candidature of Mr. Felice Pascarelli.
I propose my candidature for TiDiGino contest with an automation project of gardens made with Arduino interfaced to a PC via Bluetooth communication 100m (Class 2).
The idea was born a few days ago, I was a guest of a friend in his new villa with pool (lucky him!).
While we were strolling around the garden, we receive a call from another friend who tells us that for a few minutes was out of the gate with another large group of people (we were waiting for a while) who tried in every way (bell and trumpeted the horn) to “notify” their presence.
Once open the gate each of the newcomers has proposed a solution to replicate the sound of the bell, who has proposed to install a siren, who to include strobe lights like a disco and I proposed to replicate the bell, and maybe even open the gate on the computer.
At this point the owner, with an ironic tone, he asked me if I could do better and that the circuit have to be able to control the lights in the garden and irrigation system and check the status of microwave sensors installed to protect the garden.
After returning home I started thinking about how to resolve the issue.
I decided to design a software to run on PC that communicates via Bluetooth with a unit built around the Arduino and interfaced to the main power panel.
This led to the project “Automation Garden”.
Of course I designed the software and firmware for Arduino, although perfectly functional, but should be optimized, for lack of time (August 31 is the deadline for submissions), I send it anyway.
Let me explain briefly how it works:
the PC software communicates via Bluetooth (of course the PC must be equipped with built-in Bluetooth or USB) with another Bluetooth/RS232 HandyWave module connected to Arduino using the UART serial lines available on the pins 0 (RX) and 1 (TX).
To interface Arduino to the electrical panel I used some relay, and for interfacing it to alarm bells I used a circuit with optocouplers to avoid possible problems of shocks and surges that could destroy the Arduino.
I drew the schematic, but due to time constraints, I decided to temporarily mount it all on protoboard.
Before you start the software “Automazione_Giardino” on the PC, we associate, using the appropriate utility on the PC, the PC with the Bluetooth module mounted on the Arduino.
Once paired the Bluetooth and start the software, just select the checkbox associated to Bluetooth serial port and press the “Connect” button in the lower (see the location of these controls in the picture).
At this point, just click on the icon of the light bulbs to activated or deactivated the corresponding relay on the interface connected to the Arduino.
For the gate relay I planned pulse operation. Each time you press the icon associated with the relay opening the gate closes for 1s and then reopen.
To notify the alarm or intervention, even when the software is minimized, I provided a window that opens automatically when the event occurs and overrides any other application open on the PC.
Then just click on it to close.
The firmware installed on the Arduino does nothing more than to receive incoming commands on the serial port, interpret, active o deactive the relay and re-send the new state of the outputs or inputs. As mentioned previously the firmware should be optimized and maybe insert a checksum on the serial communication routines. But it works anyway.
You can use any other Bluetooth module perhaps with TTL output. Using a module with TTL output can eliminate RS232/TTL converter (MAX232 and boundary components) added to interface Arduino with Bluetooth HandyWave.
For those who haven’t a Bluetooth transmitter and want to try the circuit can without problems use Arduino connected via USB to the PC on which you installed the software and select the COM port assigned to the serial of Arduino.
Code
// Sistema Di Automazione Giardino // Felice Pascarelli 2011 // fpascar@tiscali.it long ritardo =300; byte rxrs232; String ricezione = ""; String rele = "0"; String bufferrx = "0"; String uscite = "K"; String rel = "0"; String rel1 = "a"; String rel2 = "b"; String rel3 = "c"; String rel4 = "d"; String rel5 = "e"; String rel6 = "f"; String in1 = "2"; String in2 = "4"; void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, INPUT); pinMode(9, INPUT); pinMode(10, INPUT); pinMode(11, INPUT); pinMode(12, INPUT); Serial.begin(19200); } void loop() { if (Serial.available() > 0) ricevirs232(); ingressi(); delay(ritardo); if(rel == "1") { if (rele == "A") { rel1 = rele; digitalWrite(2, HIGH); } if (rele == "B") { rel2 = rele; digitalWrite(3, HIGH); } if (rele == "C") { rel3 = rele; digitalWrite(4, HIGH); } if (rele == "D") { rel4 = rele; digitalWrite(5, HIGH); } if (rele == "E") { rel5 = rele; digitalWrite(6, HIGH); } if (rele == "F") { rel6 = rele; digitalWrite(7, HIGH); delay(1000); digitalWrite(7, LOW); rel6 = "f"; } if (rele == "a") { rel1 = rele; digitalWrite(2, LOW); } if (rele == "b") { rel2 = rele; digitalWrite(3, LOW); } if (rele == "c") { rel3 = rele; digitalWrite(4, LOW); } if (rele == "d") { rel4 = rele; digitalWrite(5, LOW); } if (rele == "e") { rel5 = rele; digitalWrite(6, LOW); } if (rele == "f") { rel6 = rele; digitalWrite(7, LOW); } rel = "0"; } Serial.print(rel1);Serial.print(rel2);Serial.print(rel3);Serial.print(rel4); Serial.print(rel5);Serial.print(rel6);Serial.print(in1);Serial.print(in2); } void ingressi() { if (digitalRead(8) == 0) { in1 = "1"; } if (digitalRead(8) == 1) { in1 = "2"; } if (digitalRead(9) == 0) { in2 = "3"; } if (digitalRead(9) == 1) { in2 = "4"; } } void ricevirs232() { if (Serial.available() > 0) { rxrs232 = Serial.read(); if (isDigit(rxrs232)) { ricezione += (char)rxrs232; } if(rxrs232 =='A' || rxrs232 =='B'|| rxrs232 =='C'|| rxrs232 =='D'|| rxrs232 =='E'|| rxrs232 =='F' ||rxrs232 =='a'|| rxrs232 =='b'|| rxrs232 =='c'|| rxrs232 =='d'|| rxrs232 =='e'|| rxrs232 =='f') { rele = rxrs232,BYTE; rel = "1"; } } }
BOM
| C1 100nF | C2 100uF | C3 0,33uF | C4 0,33uF | C5 0,33uF | C6 100nF | C7 47uF | C8 0,33uF | C9 0,33uF | C10 1uF | C11 1uF | C12 100nF | C13 100nF | D1 1N4007 | D2 4,8V | D3 4,8V | D4 1N4007 | D5 1N4007 | D6 LED | D7 LED | D8 LED | D9 LED | D10 LED | D11 LED | J1 DB9 | K1 RELAY_G5V-2 | K2 RELAY_G5V-2 | K3 RELAY_G5V-2 | K4 RELAY_G5V-2 | K5 RELAY_G5V-2 | K6 RELAY_G5V-2 | K7 CONN_3_V | K8 CONN_3_V | K9 CONN_3_V | K10 CONN_3_V | K11 CONN_3_V | K12 CONN_3_V | P1 CONN_6 | P2 CONN_8 | P3 CONN_2_V | P4 CONN_8 | P5 CONN_2_V | P6 CONN_2_V | R1 10K | R2 10K | R3 270 | R4 270 | R5 470 | R6 470 | R7 300 | R8 300 | R9 300 | R10 300 | R11 300 | R12 300 | U1 7805 | U2 PHDARL | U3 PHDARL | U4 MAX232 | U5 ULN2803A
Download
Software | |
Arduino sketch | |
PCB design (Kicad) |
One Comment