/ANMAK

AN-Motors Arduino Keyfob

Primary LanguageC++Apache License 2.0Apache-2.0

ANMAK

AN-Motors Arduino Keyfob

Twitter SoundCloud


Schematic


Disclaimer

IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

By using the project, you confirm that you have permission to broadcast the relevant radio signals


Description

This is a project of a remote key fob for controlling gates / barriers from AN-Motors (or others if they do not have encryption and use OOK modulation at a frequency of ~ 433MHz). AN-Motors uses similar packets to keeloq but without encryption


How to build one

For build you'll need:

  1. Atmega328P or arduino nano / mini / micro etc...
  2. Cheap 433MHz transmitter module (popular green PCBs. Often solds with a receiver)
  3. TP4056 charger module with build-in protection
  4. Any small LiPo or LiIon battery (for example from disposable vapes)
  5. 16MHz crystal oscillator, 2x22pF capacitors and 1M resistor for it (if using Atmega328)
  6. BC547 NPN transistor or any other small NPN transistor, 1K and 10K resistors for charger detection circuit
  7. Button + 10K resistor
  8. 3 LEDs + 3x470 resistors
  9. Some other capacitors and resistors (see schematic)
  10. Plastic case (For example, from tic tac, as in the photo)

  1. Using the rtl-433 project (Keeloq packets) or any other method, get a packet from your gate / barrier

    1. 12-bit preamble (ON -> wait 413us -> OFF wait 413us)
    2. 4130 us pause
    3. 66-bit payload (64bit + battery and repeat flags)
    4. ~16100 us pause
    • Payload structure:
    1. 12-bit 0x202 header (probably a constant) 0010 0000 0010
    2. 4-bit button code (ex. 0100)
    3. 8-bit + 8-bit random number (you can use constant) (ex. 0xEDED or 0xABAB or 0x9797 etc.)
    4. 28-bit ID (ex 0001001000110100010110101011) NOTE: rtl433 shows ID in little-endian. If you use the ID from rtl_433, you need to flip it
    5. 4-bit button code again (ex. 0100)
    6. Two bits of ones (11) (battery and repeat flags)
  2. Exctract ID from the packet in big-endian format. NOTE: rtl433 shows ID in little-endian. If you use the ID from rtl_433, you need to flip it

    • Example of packet: 001000000010010011101101111011010001001000110100010110101011010011. So, ID is 0001001000110100010110101011 in BIN or 12345AB in HEX
  3. Using Platformio or Arduino IDE (convert ANMAK/blob/main/src/main.cpp to .ino format) open the code

  4. Put this ID (28-bit) to the code

  5. Put button code to the code

    • Example of packet: 001000000010010011101101111011010001001000110100010110101011010011. So, 1st button is pressed with code 0100 in BIN
  6. Assemble device with whatever you find

  7. Uncomment REF_CALIBRATION, measure AREF voltage in mV and put into the VREF_ACTUAL_MV variable

  8. Comment REF_CALIBRATION, upload code, connect battery. Done!