Vehicle rfid door lock circuit

I am working on a circuit that uses an rfid fob to unlock and lock car doors. The rfid sensor is to be placed inside the lower windshield dash area, along with a 16x2 lcd that says locked or unlocked.
To test the circuit I am using a button in place of the off the shelf rfid sensor system and leds to take the place of the lock actuator. Upon installation the rfid sensor will interact with pin2 via digital write. The rfid sensor outputs a 3v pulse when the fob is authenticated. The leds will be replaced with a 2 channel relay module that will send 12v power to the lock motor for a short amount of time in either normal polarity or reverse polarity, like a solenoid.
The two problems I am having are:

  • at boot it always locks (maybe ok but I would prefer if it did not lock or unlock at boot.)
  • with repeated button presses it flips between lock and unlock without observing the delay. In operation this would make the lock mechanism jiggle between lock and unlock and stop somewhere in the middle.

Thank you for any advice

  1. If the two flip-flops are always going to be in the same state, there is no reason to have two of them.
  2. Having two nodes control one device (your two nodes for one LCD) is almost always going to end up causing problems. In this case, you manage the ACT pin, so it might be OK, but it is probably better to only have one copy of the LCD node & change the value to display. In this case, there are only two values to display on the 2nd line, so it could come from an if-else node.

We can add extra code to prevent either relay from activating at startup, but then we are not going to know the state of the lock, and we will have to randomly choose which action we will take on 1st button press (which may or may not change the actual lock position since we don’t know where it is).

The right & lower part of this patch is very close to what you had except there is only one flip-flop & the LCD has an if-else feeding L2.

The two gate nodes & the boot/delay/not nodes in the upper left are to disable the delay nodes that activate the led/relay while the system is booting. On boot, this delay is started, which disables the two gate nodes, so the other relay delay nodes cannot be started. Once this delay expires, the gates are enabled and you can start pressing the button to change lock state.

Bah…I just realized, when you enable the gate, the current value will get passed through, so the doors will just wait to lock/unlock. Since we only want a pulse to the delay node, the easy fix is to change the boolean to a pulse before we feed it to the gate node using pulse-on-true. Since the pulse will be “done” before the timer expires, nothing gets passed to gate until you start pressing the button.

image

gweimer,
Thank you for the expert help, I enjoyed watching your recommended improvements flash onto the arduino board,
Once my relay board arrives I will install the lock system into a vehicle and post a short video of it in action.

I swapped my rfid reader with the button (and changed button to digital in) and found an unexpected issue.

The rfid reader is this item:

I am running it without the relay. When powered with 12v the rfid reader outputs a 3v pulse when proper fob is presented.
The arduino lock/unlock lights flicker when the fob is presented, then stop on one state or the other.
I have the rfid poiwered from a 12v battery
Arduino powered from a 5v cell phone charger
12v ground and arduino ground connected.

This is my xod code

Sounds like the RFID device is triggering multiple times. You could reduce this issue by doing digital-read at specific intervals instead of using loop. A better solution might be debounce to ignore the flicker. The debounce node would be inserted between digital-read and flip-flop.