Garage door controller/checker
-
Time to think bout a new project.
The comming months I am building a new garage . I want to controll and check the garage via my vera3. Option is to buy a universal sensor and fibaro relais , but why not with my sensor stuff?
What does it need to do:
-open en close the garage >> via a relais what closes the contacts momentarely ( 1 or 2 seconds)
-checks if the garage is open , closed or in transit: via reed switches ; one on the open opsition and one on the closed position. >> sketch will be door sensor/siwtch.
-sensor to check if the entrance/garage door is clear to close , or emergency stop when "the beam" is interupted. >> No idea what this is called , but I guess the sketch will be like the "door sensor/ switch" .
-temperature sensor. >> ( Dallas DS18B20).What do you guys think? Is this possible? , on an arduino nano 3x reed switches and a temperature sensor?
I allready have a sketch here for 1 temperature sensor and 1 reed switch:
This one has not the IRQ pin on the radio connected , on pin 2 is a reed sensor. Can this sketch easily be adapted for 3 reedswitches and also have a relais attached?
One of the reed switches needs to be "inversed", when the contact is closed, it actually has to say "garage open".
Thanks,
Cor// Example sketch showing how to send in OneWire temperature readings #include <MySensor.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 16 #define CHILD_ID_SWITCH 17 #define BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); MySensor gw; float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; int oldValue=-1; // Initialize temperature message MyMessage msgTemp(0,V_TEMP); MyMessage msgButton(CHILD_ID_SWITCH,V_TRIPPED); void setup() { // Startup OneWire sensors.begin(); // Startup and initialize MySensors library. Set callback for incoming messages. gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Temperature Sensor", "1.0"); // Fetch the number of attached temperature sensors numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { gw.present(i, S_TEMP); } // INIT SWITCH pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); gw.present(CHILD_ID_SWITCH, S_DOOR); } void loop() { // Process incoming messages (like config from server) gw.process(); // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // Read temperatures and send them to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Only send data if temperature has changed and no error if (lastTemperature[i] != temperature && temperature != -127.00) { // Send in the new temperature gw.send(msgTemp.setSensor(i).set(temperature,1)); lastTemperature[i]=temperature; } } // READ SWITCH STATUS // Get the update value int value = digitalRead(BUTTON_PIN); // Send in the new value gw.send(msgButton.set(value==HIGH ? 1 : 0)); gw.sleep(BUTTON_PIN-2, CHANGE, SLEEP_TIME); }
-
I made a garagedoor node some time ago maybe you can find my post about it usefull.
http://forum.micasaverde.com/index.php/topic,22334.0.html
here is the current sketch I use.
-
Awesome Kortoma,
That is a very good start. Thanks for this.
When I read through the sketch ( and what I understand from it), it is not possible to have the reed switches 1 "normal" and another one "inversed"? it is both switches have to act the same?Will it be difficult to add another switch to act as a "beam" to sense if the door is clear to close it?
Can a temperature sensor be added?
Thanks,
Cor
-
I built this controller using the above code (plus atshasoft signing), and it works great when connected to computer's usb port, but doesn't work when connected to either a USB power adapter, a 12v input on the VIN pin, or 5V on the 5V pin. I'm not sure what could be the issue here. I'm using an arduino nano.
EDIT:
Ignore my stupidity. When you hook up the radio to the 5V instead of the 3.3v output only a PC has a low enough voltage for the (somehow not fried) radio to work. Connecting to the 3v3 works...
-
-
how about adding an ultrasonic sensor to tell if your car is IN the garage or not?
Suggested Topics
-
Welcome
Announcements • • hek