LowPowerLab Forum

Hardware support => Projects => Topic started by: luisr320 on February 22, 2015, 08:09:30 PM

Title: PROJECT - Gate & garage controlled by Car Lights [PHOTOS]
Post by: luisr320 on February 22, 2015, 08:09:30 PM
I wanted to include the gate into my home automation project, so a Moteino was the obvious choice to remotely control it without those pesky remotes.
Now all I have to do is assemble a module to install in my car and with a flick of the passing light, the gate opens, and a double flick will open the garage.
Stay tuned for that project soon...

This project uses a couple of components:
1 rectifying bridge, 1 condenser, 2 transistors to control the relays, two relays and a LM2596 power regulator board (the blue thing) I got from ebay.

The rectifying bridge is necessary because there is only 24v AC available in the gate control box, so it must be converted into DC, filtered with the condenser and regulated to 5v.

Here is my gate, with the control box on the left:
(http://linhadafrente.net/arduino/p1.JPG)

Size fitting a perfoboard (top right):
(http://linhadafrente.net/arduino/p2.JPG)

Parts layout, without the moteino installed:
(http://linhadafrente.net/arduino/p3.JPG)

And now, with the moteino:
(http://linhadafrente.net/arduino/p4.JPG)

Board spaghetti:
(http://linhadafrente.net/arduino/p5.JPG)

All in its place, ready to use:
(http://linhadafrente.net/arduino/p6.JPG)

Some more detail:
(http://linhadafrente.net/arduino/p7.JPG)
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: TomWS on February 22, 2015, 09:20:17 PM
Looks like a perfect application!  Nice job!  I even recognize the power module you used for the car remote control!  Good choice.

Nice photos (nice digs too!).

An interesting mod would be to have the gate Mote polling the environment, so that, when you drive up to the gate, your vehicle mote gets the poll and then responds with an 'open, says me!'.  Now that would impress a passenger!

Tom
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: luisr320 on March 01, 2015, 03:45:16 PM
The poll idea is actually a good way of detecting that the car is in the garage or out since I have the Car node hotwired to 12V. But to have it open the gate without asking for permission, might not be what I would always want. Sometimes I park the car on the curb and it would open the gates when I didn't want to.

So to continue with the remote project, the next step was to get the car Moteino remote connected to the passing lights of my car.
I found a couple of schematics on the net that would allow me to do exactly that. I decided to try to use Eagle Cad to create a small circuit board to be routed on my CNC machine.
My experience with Eagle is almost zero, beside some test experiments. So it was a challenge for me to get some useful results out of it.

This is the schematic of my Moteino car Remote I ended up with:
(http://linhadafrente.net/arduino/schem_V2.1.JPG)

Initially I had pin 6 of the optocoupler connected to R2 and pin 5 of the opto connected to pin 7 of the Moteino, but couldn't get it to work so after some research, I went on a LOW detection circuit instead, and all worked well.

The car flashing lights 12V are connected to ""LUZES"" on the board, and fed into the optocoupler trough a resistor. D1 is a 23v zener to take care of some wild current that may show up.

The Moteino pins and footprint where taken out from the original Moteino Eagle file after all circuits were deleted.

Eagle autorouter did a terrible job so after a couple of tries I ended up with this:
(http://linhadafrente.net/arduino/board_v2.1.JPG)
The blue connection is a wired via that go on the top of the single side board.

I'm sure you will find a lot of those "never do this" errors in my design, but it all worked out fine.

All components are laid down under the Moteino board so the final footprint may be as small as a Moteino itself. The caps need to be bent to the side to allow for space.
The 12/5 v conversion is done by a 78L05 linear regulator. Since there is not much current involved, it is well within the specs of the regulator.
(http://linhadafrente.net/arduino/IMG_0393.JPG)
(http://www.kompleckt.ru/images/78.jpg)

I used a script call PCBGcode on Eagle, that allowed me to produce the Gcode to route out the board tracks, as well as the Drill file with information for the CNC machine to drill the components holes.
(http://linhadafrente.net/arduino/IMG_0398.JPG)

(http://linhadafrente.net/arduino/IMG_0394.JPG)

And this is the final result. This is not the same board that is on the pic above, because this one still had the HIGH/ON logic that I changed to LOW/ON, as mentioned above.
(http://linhadafrente.net/arduino/IMG_0408.JPG)

And the other side is like this (still missing the zener which I didn't had on my parts box)
(http://linhadafrente.net/arduino/IMG_0404.JPG)
The cap on the left was rotated on the final board design so that it doesn't have to bend sideways as in this pic.

Final assembly:
(http://linhadafrente.net/arduino/IMG_0410.JPG)

All boxed up, and nowhere to go:
(http://linhadafrente.net/arduino/IMG_0415.JPG)

And finally, assembled in the car, connected to 12V, ground and the Flash light 12v wire:
(http://linhadafrente.net/arduino/IMG_0413.JPG)

So now, when I want to open the outside Gate, I flash the lights 1 time and 2 times to close it. The garage door requires 3 flashes to open, 3 to stop and 3 to close. It may also stop automatically when fully open, of course and in that case it will only require 3 flashes to open and 3 to close.

(continues...)
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: luisr320 on March 01, 2015, 03:54:39 PM
Code: [Select]
// **********************************************************************************************************
// Moteino Car Remote
// Ver. 4.2
// Changes:
// - Removed some useless Serialprint() code and Flash check routines
// - Change the click check routine to allow for a longclick to open both gates at the same time
// 2014-05-22 (C) luisr320@gmail.com
// Adapted from felix@lowpowerlab.com, http://www.LowPowerLab.com mote.ino
// Creative Commons Attrib Share-Alike License
// You are free to use/extend this code/library but please abide with the CCSA license:
// http://creativecommons.org/licenses/by-sa/3.0/
// **********************************************************************************************************

#include <RFM69.h>
#include <SPI.h>
#include <SPIFlash.h>
#include <avr/wdt.h>
#include <WirelessHEX69.h>
#include <ClickButton.h>

#define NODEID 6 //unique for each node on same network
#define GATEDOORID 5
#define GARADOORID 4
#define NETWORKID 100 //the same on all nodes that talk to each other
#define FREQUENCY RF69_433MHZ
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define ACK_TIME 100 // max # of ms to wait for an ack
#define LED 9 // Moteinos have LEDs on D9
#define SERIAL_BAUD 115200
#define LIGHTPIN 7 //Defines the pin to which the car light wire is connected

//Initialize some variables
int doorId = 0;// This variable will hold the Destination Node number
long int code = 0;// This variable will hold the code that will be sent to a node

// Hardware Init
SPIFlash flash(8, 0xEF30); //Initiate the FLASH chip - EF40 for 16mbit windbond chip
RFM69 radio; // Initiate the radio
ClickButton lightFlashes(LIGHTPIN, LOW, CLICKBTN_PULLUP);//Initiate the button class

void setup()
{
//Setup the pins
pinMode(LED, OUTPUT);

// Setup button timers (all in milliseconds / ms)
// (These are default if not set, but changeable for convenience)
lightFlashes.debounceTime   = 20;   // Debounce timer in ms. Default 20
lightFlashes.multiclickTime = 500;  // Time limit for multi clicks. Default 200
lightFlashes.longClickTime  = 1000; // time until "held-down clicks" register. Default 1000

//Start the Serial port
Serial.begin(SERIAL_BAUD);

//Initialize the radio
radio.initialize(FREQUENCY,NODEID,NETWORKID);
radio.setHighPower();
radio.encrypt(ENCRYPTKEY);//Turn encryption ON
radio.promiscuous(false);//Turn off promiscuous mode to allow Wireless Programming
}


void loop()
{
//Check if some data came trough the radio
if (radio.receiveDone())//If some packet was received by the radio, wait for all its contents to come trough
{
//Check if data is wireless programming
CheckForWirelessHEX(radio, flash, true);// If the WP header is detected, start WP routine and restart the MCU at the end 
}
   
//Check if the light was flashed
lightFlashes.Update();//lightFlashes.Update will fill lightFlashes.clicks variable with the number of light flashes

if (lightFlashes.clicks != 0)
{
if (lightFlashes.clicks == 1)//One light flash
{
doorId = GATEDOORID;
code = 1;//Open the Gate
//Send code to doorId node via radio
if (radio.sendWithRetry(doorId, (const void*)&code, sizeof(code), 5, ACK_TIME))
{
Blink(LED,50);
}
  }
else if (lightFlashes.clicks == 2)//Two light flashes
{
doorId = GATEDOORID;
code = 2;//Close the gate
//Send code to doorId node via radio
if (radio.sendWithRetry(doorId, (const void*)&code, sizeof(code), 5, ACK_TIME))
{
Blink(LED,50);
}

}
else if (lightFlashes.clicks == 3)//Three light flashes
{
doorId = GARADOORID;
code = 1;//Open or Close the Garage Door
//Send code to doorId node via radio
if (radio.sendWithRetry(doorId, (const void*)&code, sizeof(code), 5, ACK_TIME))
{
Blink(LED,50);
}
}
else if (lightFlashes.clicks == -1)//Hold flash lights for more then 1 second
{
doorId = GATEDOORID;
code = 1;//Open the Gate
//Send code to doorId node via radio
if (radio.sendWithRetry(doorId, (const void*)&code, sizeof(code), 5, ACK_TIME))
{
Blink(LED,50);
}
doorId = GARADOORID;
code = 1;//Open or Close the Garage Door
//Send code to doorId node via radio
if (radio.sendWithRetry(doorId, (const void*)&code, sizeof(code), 5, ACK_TIME))
{
Blink(LED,50);
}
}

//reset variables
lightFlashes.clicks = 0;
doorId = 0;
code = 0;
}
}


void Blink(byte PIN, int DELAY_MS)//Local led blinking function
{
pinMode(PIN, OUTPUT);
digitalWrite(PIN,HIGH);
delay(DELAY_MS);
digitalWrite(PIN,LOW);
}
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: luisr320 on March 01, 2015, 04:13:43 PM
To check for the number of light flashes, I installed a library that does exactly that, ClickButton.h, that counts button clicks, where I can define the timings between clicks (or light flashes in this case) to still be considered a sequence of clicks, debounce timing, and if the button is ON when LOW or HIGH.
The library can be found here:
https://code.google.com/p/clickbutton/ (https://code.google.com/p/clickbutton/)
All I had to do was insert
Code: [Select]
#include <ClickButton.h>

Initiate an instance of Clickbutton
Code: [Select]
// Hardware Init
SPIFlash flash(8, 0xEF30); //Initiate the FLASH chip - EF40 for 16mbit windbond chip
RFM69 radio; // Initiate the radio
ClickButton button1(LIGHTPIN, LOW, CLICKBTN_PULLUP);//Initiate the button class

And define the timings in the setup()
Code: [Select]
button1.debounceTime   = 20;   // Debounce timer in ms
button1.multiclickTime = 500;  // Time limit for multi clicks
button1.longClickTime  = 1000; // time until "held-down clicks" register

Then, on the loop() I run the button state by running
Code: [Select]
button1.Update();

This will return a variable (button1.clicks) filled with the number of clicks that was counted and then process that into the radio.sendWithRetry to command the respective Gate node.

Initially I wanted the Car node to connect directly to the Gateway and the Gateway would then dispatch the commands to the Gate nodes. This way I could monitor when the gates were commanded to be opened or closed. But since the Car node is deep inside the metal framework, the connection to the gateway wasn't very reliable, so I decided  to directly control the gate nodes avoiding having to deal with an intermediary.

As the car is always in close proximity with the gate control boxes where the nodes are installed, this works very well and now I get 100% reliability on the process.

The Car node is hotwired to the car 12v so that I may open or close the doors without having the ignition ON. As the whole thing only consumes 23ma, there isn't much drain on the battery. However, I will change the design in a near future to have the board sleeping just to wake-up when the lights are flashed on a interupt pin. That will drop the current into the micro amps range.

Keep tuned... :)
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: TomWS on March 01, 2015, 06:02:33 PM
Um, you're probably going to blowout your Moteino and radio running it from 5V driven into its 3.3V OUTPUT.   The 5V power should be driven into the PWR pin of the Moteino.  And the pullup from the opto isolator driven from the 3.3V OUTPUT of the Moteino. 

The 5V regulator isn't really necessary either, you can power the Moteino directly from the car supply (nominally 12V but will reach above 14V when charging).  The Moteino regulator can handle up to 16V, but this usually makes Felix cringe (which we like to do on occasion)   :D

Tom
Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: luisr320 on March 02, 2015, 01:49:30 AM
Thank you TomWS for your comments and for noticing that error which I did on the first run.

If you check the lower part of the circuit board, the one with the messy soldering, you can see that I did change the connection from the 3.3v OUTPUT of the Moteino to the 5v POWER, the pin next to the GND.
I will make the changes on the schematic and board layout today and replace the ones posted here.

As for the 5V regulator, I already had one blown on my first Moteino so I always prefer to have a cheap voltage regulator to ease on the Moteino's regulator. Not that the Moteino regulator is weak for the job, but the poor thing can't handle all the bad thing I did to it like reverse polarity and other terrible things. :-/

I'm also considering using a temperature sensor to compensate for the engine high temp to avoid frequency drift and build a PCB for the Outer Gate Moteino Node to replace the perfoboard.

As the car box is very accessible I'll keep on upgrading it as soon as I have more available time from my busy work.

I'll make a video showing how it all works soon.

Title: Re: PROJECT - Gate control [PHOTOS][FINISHED]
Post by: TomWS on March 02, 2015, 08:43:21 AM
Thank you TomWS for your comments and for noticing that error which I did on the first run.

If you check the lower part of the circuit board, the one with the messy soldering, you can see that I did change the connection from the 3.3v OUTPUT of the Moteino to the 5v POWER, the pin next to the GND.
I will make the changes on the schematic and board layout today and replace the ones posted here.
<snip...>
I see that you moved that leg (on the PCB) to the PWR pin, which will save your radio, however, this still leaves R2 pulled up to 5V, rather than 3.3V as it should be.  Fortunately, you've changed R2 to a 10K resistor so that will reduce the amount of potentially damaging current into pin 7.

Tom
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 02, 2015, 12:48:43 PM
I'm in the process of changing the input pin to pin 3 to use the interrupt function and connect it to 3.3v.
Should I switch R2 back to 4.7k?
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: TomWS on March 02, 2015, 03:34:45 PM
I'm in the process of changing the input pin to pin 3 to use the interrupt function and connect it to 3.3v.
Should I switch R2 back to 4.7k?
It depends on the code you use to sense a change on the pin.  Opto-isolators, especially open collector ones, are notoriously slow rise time (the transistor takes a long time to turn off).  The higher the current into the collector, the faster it will turn off (to a point, of course).  4.7K pulled to 3.3V will give you just a bit faster rise time than 10K pulled up to 5V, conversely, keeping it at 10K it will be almost twice as long a rise time.

Tom
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 02, 2015, 06:20:23 PM
I have updated the Car RC schematic, presently on version 2.1, in order to get the input on pin 7 coming from a 3.3V pullup, from a 4,7K resistor.
I'm not going to try the interrupt feature of pin 3 yet, so for now it is still connected to pin 7.
I have also changed the circuit board, accordingly, to version 2.1.

Tomorrow I'm going on a trip, but on Friday I will be able to create a new PCB and test this changes. So consider this project as Beta for now.

Thank you, TomWS, for your inputs.

I'm also posting a link to the Eagle Cad files, just in case someone might want to have a go on a similar project.

Eagle Cad files - Ver. 2.1 (http://www.linhadafrente.net/arduino/Moteino Controlo Remoto carro V2.1.zip)

Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 08, 2015, 01:16:44 PM
I decided to replace the prototype perfoboard on the gate with a PCB milled on my CNC machine.

This is the PCB layout:
(http://www.linhadafrente.net/arduino/PCB_VER3.0.jpg)

I decided to replace the power regulator by a linear 7805 regulator.
I have also inserted a DS18B20 temperature sensor under the Moteino radio so that I may include some frequency temperature compensation routine on the sketch.
I have no idea on how to do that yet, but I found a couple of post here in the forum pointing in that direction.

I decided to not include the DS18B20 in this project.

I have also change the big rectifying bridge for a smaller one and switched the relays for a couple of 3.3v ones.

This is the new schematic of the Gate Door Node:

(http://www.linhadafrente.net/arduino/Gate_Door_Schem_Ver3.0.jpg)

I'm milling the board now and I'll post a couple of photos when its ready.

These are the Eagle files:
Moteino Gate Door V3.0.zip (http://www.linhadafrente.net/arduino/Moteino Gate Door V3.0.zip)
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: Felix on March 08, 2015, 04:40:35 PM
Very nice, any chance to post a video of milling the PCB? :D
I'd like to one day get into milling PCBs at home also .. just not enough time in this life :(
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: TomWS on March 08, 2015, 05:21:28 PM
I decided to replace the prototype perfoboard on the gate with a PCB milled on my CNC machine.

<snip...>
Interesting.  I've looked at using my CNC router for this but haven't pursued it.  I use the router for V Grooving panelized boards, but haven't done any other PCB routing.

Three questions:
What software did you use (ie to go from schematic to GCODE)?
What router bit do you use?
How deep do you route below the surface?

Tom
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 08, 2015, 10:19:03 PM
Almost finished.
I milled the PCB on my CNC machine and this is the result (the relays are just place holders for the 3.3V i'm getting tomorrow):
(http://www.linhadafrente.net/arduino/Gate_Board_V2.0.jpg)
(http://www.linhadafrente.net/arduino/Gate_Board_2_V2.0.jpg)

Regarding your questions:
Quote
What software did you use (ie to go from schematic to GCODE)?
I use Eagle Cadsoft to draw the board and then I run a ULP script called "pcb-gcode" that is available free here:
http://pcbgcode.org/read.php?12,941 (http://pcbgcode.org/read.php?12,941)
I then load the G_Code directly in MACH3, set the machine up and press RUN

Quote
What router bit do you use?
I use a carbide 60 V tool. I bought it from a local store.

Quote
How deep do you route below the surface?
The script is programed to the dept of 0.127mm, with a etching tool size of 0.1788mm

I haven't perfected the method yet but it's good enough for a quick job.
There are other scripts that you can run that will perform a auto-leveling of the PCB and for optimizing the bit travel but I don't use them. I just use double sided tape and stick the PCB to the machine table and fire away.

I'm preparing a 1 minute video of the board milling and will post it on Youtube to get a link.

This is the result (red trace is a error I did on the design):
(http://www.linhadafrente.net/arduino/coperside.jpg)

Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 08, 2015, 10:58:59 PM
Here you go. :)

Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: TomWS on March 09, 2015, 12:43:52 AM
Great! Thanks for the info!

Tom
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][FINISHED]
Post by: luisr320 on March 12, 2015, 08:44:37 PM
I got the 3V relays from finder today so I managed to finish the assembly.
With the 7805 attached to the copper by a bolt, there is almost no heat generated by the 12v / 5v conversion.

I decided to remove the temperature sensor. It seems to be a solution to a non existing problem. "If it ain't broken, don't fix it".

I had to downsize the 10k resistors of the 2N2222 to 1k to have a more reliable actuation on the relays.

All Eagle Files are updated for version 3.0 of the schematics.
Tomorrow I will install it in place of the perfoboard.

(http://www.linhadafrente.net/arduino/Gate_Board_V3.0.jpg)
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on March 13, 2015, 10:04:16 AM
And here it is installed, replacing the perfoboard one:

(http://www.linhadafrente.net/arduino/Gate_Board_V3.0_installed.jpg)

Next, I'm going to assemble a Moteino Garage Mote to replace the breadboard I have to control the garage door.

Stay tuned...
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on March 18, 2015, 09:23:04 AM
On with this project.

To control the garage door I have a moteino installed on a breadboard and that had to be replaced by something more suitable.
So I decided to get a Garagemote from Lowpowerlab, since it had everything I needed. I'm sure Felix doesn't mind me hacking his board.
I didn't needed the hall sensors and instead used a 10 turn 100k potentiometer to get an accurate feedback of the whereabouts of the door.
Some photos:

My Garagemote assembled. As I said before, I removed the two resistors that still show up on this photo:
(http://www.linhadafrente.net/arduino/IMG_0472.JPG)

I wanted to mount everything inside a nice box along with the power regulator, so I cranked up my Mastercam soft to produce the required G codes to cut a perfoboard to the required size:
(http://www.linhadafrente.net/arduino/IMG_0473.JPG)

Cutting:
(http://www.linhadafrente.net/arduino/IMG_0474.JPG)

Ready to use:
(http://www.linhadafrente.net/arduino/IMG_0475.JPG)

All parts installed and power regulator adjusted:
(http://www.linhadafrente.net/arduino/IMG_0476.JPG)

(http://www.linhadafrente.net/arduino/IMG_0478.JPG)

Now the potentiometer. I used a Bourns 10 turn 100k potentiometer attached to a rubber cork. The rubber cork was inserted into the rolling shaft of the door and would rotate along with the door. Since the shaft turns exactly 10 turns, it was a perfect match:
(http://www.linhadafrente.net/arduino/IMG_0479.JPG)

(http://www.linhadafrente.net/arduino/IMG_0480.JPG)

(http://www.linhadafrente.net/arduino/IMG_0482.JPG)

(http://www.linhadafrente.net/arduino/IMG_0481.JPG)

And now everything is connected, ready to be installed:
(http://www.linhadafrente.net/arduino/IMG_0486.JPG)

(http://www.linhadafrente.net/arduino/IMG_0487.JPG)

I have a short video that I will present in the next post with the whole thing explained.
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: TomWS on March 18, 2015, 09:50:14 AM
Luis, I like your 'rotary encoder'!  Very innovative!   :)

Tom

Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on March 18, 2015, 10:02:11 AM
Those potentiometers are a bit pricey but totally worth it. 
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on March 18, 2015, 12:06:41 PM
Here's the video.  :)
Title: Re: PROJECT - Gate controled by Car Lights [PHOTOS][UPDATED]
Post by: Felix on March 18, 2015, 05:47:42 PM
This is sweet, really like your solution. Hats off to the potentiometer hack, very clever.
You make nice videos too, and nice TT!
I wonder how you trigger it when you come home at night (in the dark with your headlights ON). Or is it your long beam that is the trigger?
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on March 18, 2015, 06:15:19 PM
Thank you. I really like my TT.
Yes, it is connected to the long beams. Even if I have the regular lights on, they will only open the gates if I use the long beams momentarily. To avoid passing weird currents into the Moteino from the car electrical circuit, I use an optocoupler and that worked out very well.
It is a project that I always wanted to do after I saw a Fibaro Promotional video. Fibaro is an European company that makes very nice Zwave devices for home automation. They have a video where a guy approaches his house with his car and after flashing the lights his gate open. Unfortunately they don't sell the car Zwave module any more. So I had to create my own. Thanks to the Moteino.

Just out of curiosity, here's the Fibaro promotional video I'm refering to:https://www.youtube.com/watch?v=ThL1RoAxCP4 (https://www.youtube.com/watch?v=ThL1RoAxCP4)
Go to minute 1:17 to see what I mean :)
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS][UPDATED]
Post by: Felix on April 09, 2015, 08:24:58 AM
Congrats, you are on HACKADAY: http://hackaday.com/2015/04/08/blink-thrice-to-let-me-in/

And BTW, as you might have noticed, I managed to add a plugin that will show the youtube videos, just paste the links. That was a must with such cool videos that you and others started posting with their projects. All older links are also now shown as embedded videos :D
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS][UPDATED]
Post by: luisr320 on April 09, 2015, 10:17:14 PM
Hurray!!! Another Moteino project in Hackaday.
Regarding the videos, I can't seem to make them run. It's all black. Even if I edit the message and insert the [youtube] thingy.
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS]
Post by: spark on November 14, 2015, 04:05:34 PM
Nice project.  I just built a breadboard version of this....works like a charm!  Here is a modified version of the code for the carMote that works directly with the "out-of-the-box" GarageMote code.

Code: [Select]

#include <RFM69.h>
#include <SPI.h>
#include <SPIFlash.h>
#include <avr/wdt.h>
#include <WirelessHEX69.h>
#include <ClickButton.h>

#define NODEID 6 //unique for each node on same network
//#define GATEDOORID 11
#define GARADOORID 11
#define NETWORKID 100 //the same on all nodes that talk to each other
#define FREQUENCY RF69_433MHZ
#define ENCRYPTKEY "insertYourKeyHere." //exactly the same 16 characters/bytes on all nodes!
#define ACK_TIME 100 // max # of ms to wait for an ack
#define LED 9 // Moteinos have LEDs on D9
#define SERIAL_BAUD 115200
#define LIGHTPIN 7 //Defines the pin to which the car light wire is connected

//Initialize some variables
int doorId = 0;// This variable will hold the Destination Node number
long int code = 0;// This variable will hold the code that will be sent to a node
char buff[3];
String cmd;

// Hardware Init
SPIFlash flash(8, 0xEF30); //Initiate the FLASH chip - EF40 for 16mbit windbond chip
RFM69 radio; // Initiate the radio
ClickButton lightFlashes(LIGHTPIN, LOW, CLICKBTN_PULLUP);//Initiate the button class

void setup()
{
  //Setup the pins
  pinMode(LED, OUTPUT);

  // Setup button timers (all in milliseconds / ms)
  // (These are default if not set, but changeable for convenience)
  lightFlashes.debounceTime   = 20;   // Debounce timer in ms. Default 20
  lightFlashes.multiclickTime = 500;  // Time limit for multi clicks. Default 200
  lightFlashes.longClickTime  = 1000; // time until "held-down clicks" register. Default 1000

  //Start the Serial port
  Serial.begin(SERIAL_BAUD);

  //Initialize the radio
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  //radio.setHighPower();
  radio.encrypt(ENCRYPTKEY);//Turn encryption ON
  radio.promiscuous(false);//Turn off promiscuous mode to allow Wireless Programming

//    // indication that end of setup is running, blink for 5 seconds
//  for (int i=1; i<=10; i++)
//  {
//    Blink(LED,250);
//    delay(250);
//  }
}
 

void loop()
{
  //Check if some data came trough the radio
  if (radio.receiveDone())//If some packet was received by the radio, wait for all its contents to come trough
  {
    //Check if data is wireless programming
    CheckForWirelessHEX(radio, flash, true);// If the WP header is detected, start WP routine and restart the MCU at the end 
  }
   
  //Check if the light was flashed
  lightFlashes.Update();//lightFlashes.Update will fill lightFlashes.clicks variable with the number of light flashes
 
  if (lightFlashes.clicks != 0)
  {
    if (lightFlashes.clicks == 1)//One light flash - open the garage door
    {
      doorId = GARADOORID;
//      cmd = "OPN";
//      cmd.toCharArray(buff,3);
      buff[0] = 'O';
      buff[1] = 'P';
      buff[2] = 'N';
      byte len = strlen(buff);

      //Send code to doorId node via radio
      if (radio.sendWithRetry(doorId, buff, len, 5, ACK_TIME))
      {
           Blink(LED,50);
      }
    }
    else if (lightFlashes.clicks == -1)//Hold flash lights for more then 1 second
    {
        doorId = GARADOORID;
        buff[0] = 'C';
        buff[1] = 'L';
        buff[2] = 'S';
        byte len = strlen(buff);

        //Send code to doorId node via radio
        if (radio.sendWithRetry(doorId, buff, len, 5, ACK_TIME))
        {
          Blink(LED,50);
        }
    }

    //reset variables
    lightFlashes.clicks = 0;
    doorId = 0;
    code = 0;
  }
}


void Blink(byte PIN, int DELAY_MS)//Local led blinking function
{
  pinMode(PIN, OUTPUT);
  digitalWrite(PIN,HIGH);
  delay(DELAY_MS);
  digitalWrite(PIN,LOW);
}
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS]
Post by: WhiteHare on February 19, 2016, 02:04:46 PM
Are you able to mill PCB's with the required accuracy to do some of the surface mount parts being discussed on other threads that may have a mere 0.25mm gap between the pads?  I'd like to have a go at this, but the required accuracy seems daunting.  I'm guessing ballscrews would be needed,but I'm not sure whether or not  even they would have too much backlash.  Plus, runout on the spindle is going to be a factor as well.

I purchased some 0.1mm 20 degree etching points and also some 0.2mm 30 degree etching points.   I think my drillpress probably has too much runout, but maybe if mounted in a dremel (using a dremel press), it might work without too much runout(?).  I don't presently have a mill, but I do have the Proxxon XY table (KT70) that I could maybe use for running some quick tests to see whether or not there's a snowball's chance of it working.

[Update: I went ahead and purchased the Dremel "workstation" today (really a Dremel press), so at least I'll get a sense from that what the runout on a dremel is like.  Perhaps I can manually cut a solder mask out of soda can aluminum using the dremel press to provide an on/off z-axis and the Proxon xy table to orientate the metal sheet for cutting. 

It looks as though 0.1mm is the smallest etching point available.  I've read that 10 degree 0.1mm are mostly good at producing nasty shrapnel, which is why I went with 20 degree 0.1mm.

It occurs to me that the screws on most CNC machines may be too coarse for supporting this type of work.  I get the impression that 5mm of travel per turn is what's common, but that seems like maybe too coarse for the  level of accuracy required to etch the traces for fine pitched SMD parts.  So, I'm just wondering aloud here as to whether finer threads on a regular screw might actually outperform a 1605 ballscrew in terms of accurate positioning?

Proxxon has come out with their own CNC machine that, unfortunately, is super expensive.  What's interesting is that Proxxon claims that for really high accuracy CNC milling you also need brakes on the stepper motors to lock them down while doing cuts.  I guess that's yet another way to address the backlash issue.  There are inexpensive ($50) adapter kits, though, which allow the low-end ($400) Proxxon mill to be outfitted with stepper motors, and if it turns out to be accurate enough I may go that route.   Perhaps adding some stepper brakes and also some precise linear encoders for positional feedback would do the job.  That said, I'd really prefer to just buy something off the shelf, if it were affordable that is.]
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS]
Post by: luisr320 on February 19, 2016, 05:56:19 PM
The biggest challenge is the way to deal with an uneven surface. 0.25 mm is very narrow margin. You must use a script called autoleveller from here: http://www.autoleveller.co.uk, in order to prescan the warp on your board and then run the PCBGCODE created by EAGLE CAD. For a 0.25 precision, I don't think you can't use a Dremel tool. But if you already have all the parts, make a test a see what happens.
Title: Re: PROJECT - Gate & garage controlled by Car Lights [PHOTOS]
Post by: WhiteHare on February 19, 2016, 09:44:09 PM
Looks as though the OtherMill ($2,200) could maybe do the business.  It claims to have a resolution of 0.001", and for PCB milling the smallest bit they offer is a 1/100" end mill bit for use on an copper FR1 PCB substrate (for whatever reason, they advise against FR4).