Hello!
Recently we wrote about ( once and twice ) that we released a new version of the controller for automation - Wiren Board 5. Today we will tell in detail, perhaps, about the most important thing in the controller - its expansion modules.
Our first idea was to make a sufficiently versatile controller for home and commercial automation - with different wired and wireless interfaces, RS-485, inputs for connecting buttons, relays, etc. The advantage of this approach is a very high functionality / price ratio: for little money the user gets a bunch of interfaces.
The experience of using the first versions of controllers showed that only a few interfaces are usually used.
And if wired interfaces are used, they quickly begin to be missed: for example, if the meters and peripheral devices are connected via RS-485 and have different protocols, then often they are not compatible and they need to be connected to different ports. If buttons, counters and sensors with “dry contact” outputs are connected, there are a lot of corresponding inputs needed and they are not enough, etc.
Often customers ask for some very specific functions. Of course, you can “redraw” the controller to implement the necessary functionality, but launching a new revision of the equipment, even with minor changes, is a big deal, working for 2-3 months:
Because of this, I would very much like to have a controller in the form:
This scheme has the following advantages:
As a result of much thought, the modular design of the WB5 was born.
The first type of modules is soldered to the microassembly controller board.
About other types we will tell more.
These modules are installed on the DIN-rail on the second floor:
These are small scarves, placed vertically in the controller. In the Wiren Board 5 controller there are two slots for them, for each slot there are three terminals. Power, interfaces UART, SPI, I2C, GPIO are brought to the combs. When assembling, the boards are pressed against the case from above, so they cannot fall out of vibration.
Already developed:
-RS-232.
-CAN (Isolated)
-RS-485 (Isolated)
- ADC - (coming soon) voltage inputs, 0-20mA inputs, PT100 and PT1000 sensors
-CAP - outputs 0-10V
-3 entrances "dry contact"
-GPS / Glonass
-Additional 1-Wire
- microSD card
-Relay SPDT 6A
Basically, they are simple, there is nothing special to tell about circuitry, so we go further.
But about this type is to tell more.
Often there are tasks when you need a large number of I / O channels - connecting pulse meters, controlling contactors, etc. In this case, we connect external, side modules, which are joined to the controller in series up to 8 pieces.
An I / O module needs additional GPIOs. The easiest way to do this is using the so-called GPIO extenders for I2C. We use extenders MCP23008 and MCP23016. They have three legs for setting the address, so it is possible to have up to 8 devices on the bus. Addresses are distributed as follows - 000 100 010 001 - sequentially by module.
Addresses are inverted on the input modules, and they get the addresses 111 011 101 110. This allows you to connect up to 8 pieces (4 + 4) and in the future automatically determine their type - input it or output.
From left to right are the modules: TTL I / O, “dry contacts”, “High side switch”, “Inputs 220V”, relay block.
More about each:
8 Relays for 10A @ 230V, with protection against arcing of contacts on varistors.
To reduce consumption and heat, after turning on the relay, you can reduce the current on the control coil by 2 times. The simplest way is to use the circuit as in Figure 1 - Turn on the relay with two transistors, one with a resistor. We give a signal - both transistors open - the nominal current flows, through time R1C1 the transistor Q1 closes - the current flows through R2. By reducing the current by 2 times, we reduce consumption by 2 times.
A more reasonable way to control a relay is to use PWM. Then, reducing the current by 2 times, reduce the consumption by 4 times. It is good when there is a microcontroller: it has many shima channels, you can control it directly with a transistor. But what if SHIMA is not? Need to do it. Take the 555th timer, or rather its reincarnation MIC1557, and let it generate PWM for us with a duty cycle of 50%. On the diodes collect the logical element “OR”. So when you turn on any of the relays, the timer is turned off and the relay receives a full 5V.
Module to determine the presence of voltage in the network. 8 channels.
The simplest solution for monitoring 220 V is an optocoupler with a resistor. The problem with such a simple solution is that the optocouplers have a large CTR (current transfer coefficient) spread and reliable operation requires at least 1 mA of current, and the input should be from 50V AC - as a result, a lot of heat is generated on the resistor. And since inputs 8 - then the board will be very hot.
There are different ways to reduce heat. For example, you can use an optocoupler with a transistor Darlington output (large CTR), and use a capacitor instead of a resistor. We didn’t put the capacitor, but used the following trick: if you look at the “CTR vs. input current” characteristic of the optocouplers, you can see that the curve has a peak at a current of 1-2 ma. Therefore, if current is supplied with short pulses of 1 ma each, it is possible to ensure a high CTR with a low average input current. The dinistor and the capacitor form these pulses to us.
Explanations of the scheme: R4-R6 charge C2, when reaching ~ 35V, the dynistor is triggered, while R3 sets a current of 1-2 ma through the optocoupler. D1 protects the optocoupler against reverse polarity. R1 C1 average pulses.
For connecting buttons, impulse meters, etc.
The input is triggered by a ground fault.
There is a group galvanic isolation. Protection against voltage supply up to 30 V.
This is a GPF with overvoltage protection on a polyfuse and a protective diode. Levels - 5V TTL.
Designed to control low-voltage load (the output delivers a voltage of 12-45 V, current up to 0.5A).
Here we decided to move away from the beloved principle of reinventing our bicycle and used a ready-made chip like the smart key BTS4880R . The chip has built-in protection against overvoltage, overheating, short circuit, etc.
In this article, we talked about the hardware solutions that are used in the expansion and input-output modules for the Wiren Board. In the next article we will tell about their use, why they are needed and how to use the controller as a whole.
Our company is expanding, and we are looking to the team for another Linux system programmer - to develop software for our devices. The tasks are interesting, the conditions are flexible, we write the code immediately to the github . Details in the job description .
Source: https://habr.com/ru/post/394375/
All Articles