Close
0%
0%

Cheap Chinese Closet Controller

alliterations are awesome

Similar projects worth following
Working with RS485 and modbus on an Arduino with all those cheap controller thingies and weird libraries

Relay module is called R421A08

  • Working voltage: DC 12V ( going to an LM7805 without cooler)
  • Working current: Standby 12 mA + 27mA per relay
  • Open, close, jog, self-locking, interlock, delay six kinds of work modes
  • MODBUS command control mode
  • Maximum delay 255 seconds under MODBUS instruction
  • MODBUS command In addition to the serial port super terminal input, but also can be used "Modbus Poll" input
  • MODBUS command mode, up to 64 devices can be used in parallel
  • Size: 90 * 62 * 19.5mm
  • Weight: 115 grams
  • Maximum load: 10A / 250VAC, 10A / 125VAC, 10A / 30VDC, 10A / 28VDC, 10A / 12VDC

Details download from here (copy and paste open) 

/*

  based on code by youtube Adam Maszynotwór
  8-channel module RS485 DC DC 12V Modbus RTU 485
  Przykładowy program do płytki z 8 przekaźników sterowanych przez RS485 Modbus
  based on: Modbus RTU Client Kitchen Sink
  https://www.arduino.cc/en/ArduinoModbus/ArduinoModbus

  https://onedrive.live.com/?authkey=%21AHMWY%2DWpVi%5FfgPI&cid=41BCA72A6F31C9BD&id=41BCA72A6F31C9BD%21687&parId=41BCA72A6F31C9BD%21686&o=OneUp

  board control description :
  the sign 0x0 means that the entry is hex in brackets gives the values dec

  no. you select devices (slave address) thanks to DIP Switch (switches on the board)

  register no. - the relay is another register

  0x0001 (1)
  0x0002 (2)
  0x0003
  0x0004
  0x0005
  0x0006
  0x0007
  0x0008 (8)
  
  Commands
  0x0100 (256) ON
  0x0200 (512) OFF
  0x0300 (768) toggle Change state if ON changes to OFF lob if currently OFF it changes to ON
  0x0400 (1024) puts out all the other lights selected
  0x0500 (1280) extinguishes all and switches the selected one for 1 sec
  0x0601 - 0x06FF (1537-1791) is a time switch on from 1-255 sec

  zainstaluj biblioteki !
  <ArduinoRS485.h>
  <ArduinoModbus.h>
*/

#include <ArduinoRS485.h> // ArduinoModbus depends on the ArduinoRS485 library
#include <ArduinoModbus.h>

void setup() {
  Serial.begin(9600);
  while (!Serial);

  // Serial.println("Modbus RTU Client Kitchen Sink");

  // start the Modbus RTU client
  if (!ModbusRTUClient.begin(9600)) {
    Serial.println("Failed to start Modbus RTU Client!");
    while (1);
  }
}

#define SWITCH_ON 0x0100
#define SWITCH_OFF 0x0200
#define SWITCH_TOGGLE 0x0300
#define SWITCH_1SEC 0x0601

void loop() {

  // for (int id = 1; id < 3; id++)
  // {
    // this command corresponds to the modbus 6 command,
    // i.e. writing to a single register ModbusRTUClient.holdingRegisterWrite 
    // - it is the address of the device 1,
//    - it is the register number 0x0001, 
//    - it is the value to be assigned in the register 0x0100);
    // in other words, we send the command 01 06 0001 0100 (the checksum is calculated automatically)
    ModbusRTUClient.holdingRegisterWrite(2, 0x0001, SWITCH_1SEC); // SWITCH_1SEC
    delay(2000);
  // }
}

  • more problems and fixes

    davedarko08/29/2019 at 12:53 0 comments

    Two out of three solenoids are "burned" / jammed at this point. When I was cutting the switch connectors off of the locks, I didn't check the wiring. Some of the connectors had switched red and black wiring. I first thought my 700mA was not big enough, but it died regularly when two coils where powered at the same time.

    Now I only have a problem where my signals aren't strong enough every 9/10 times. Two times out of those it will recognise something, but then the checksum must be bad as it doesn't do what it was told. 

    Not yet sure how important that is, but I found a 4k7 pulldown resistor on the A+ connection of the relay board. The 4k7 resistor connected to B- leads to nothing an unpopulated resistor footprint. The chip itself seems to be a MAX485.

    Biasing and termination resistors in a story factor with oscilloscope pictures:

    http://support.fccps.cz/download/adv/frr/RS485/RS485.html

View project log

Enjoy this project?

Share

Discussions

Bharbour wrote 08/29/2019 at 15:20 point

Solenoid drivers often have a higher voltage/current pull in pulse, followed by a lower voltage/current hold in state. This minimizes heating in the coil and keeps enough force on the initial actuation to make sure the mechanism operates reliably. Some pinball flippers of old used this method. The only solenoid actuated door lock that I have seen the insides of, used this approach. Note that this is not the lock system where the electro-magnet actually keeps the door closed, those are different.

  Are you sure? yes | no

davedarko wrote 09/13/2019 at 12:30 point

My main problem was that I've shorted 12V to GND when activating the relays, sadly :) 

  Are you sure? yes | no

Bharbour wrote 09/13/2019 at 19:20 point

That sounds like it could be a problem!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates