FLProg + nooLite
- Tutorial
First of all, I want to warn that this is not an advertising post, I have nothing to do with the company - the manufacturer of the equipment described in the article, and I do not have any cookies from it other than the equipment provided for integration into the program. This is a training post that shows how to control this equipment using the FLProg program. Naturally there will be a small overview of the blocks I have and my personal attitude to these devices.
Now a little background. One of the users of the program turned to the Nootechnika company with a proposal to create a user block (at that time the program already had such an opportunity) for working with the equipment they produce through the FLProg program. The head of the enterprise went a different way. He contacted me and offered to provide me with samples of his products for their integration into the program. Having studied the proposal, I agreed, because the site had a library for working with the transmitter module, there was a good description available, and I did not see any problems. The parcel arrived very quickly (which is strange for the Russian post), even taking into account the border crossing.
What has come:
MT1132 transmitter module
The MT1132 module is designed to control the power blocks of the nooLite system from the Arduino platform, microcontrollers, or PCs.
Structurally, the module is made in the form of a printed circuit board on which the control controller and transmitter are located.
The module is controlled via the serial UART interface. The module receives control commands received via UART and transfers it to power units via the built-in radio transmitter.
Power unit SD111-180
Radio-controlled LED RGB controller (power unit) nooLite SD111-180 is designed to control a 12 V LED strip. The LED strip can be either tri-color (RGB) or single-color.
Power block SU111-300
The SU111-300 power unit is a universal radio switch designed for remote on / off lighting with the ability to adjust brightness for dimmable light sources (incandescent lamps, LED dimmable lamps). The unit can operate in two modes: relay and dimming, depending on the expected type of load. In relay mode, the SU111 300 is capable of handling any type of load.
More information about these devices can be found on the manufacturer's website.
Blocks are made very high quality. I suspect that the enterprise operates on the basis of some former Soviet enterprise, and in Soviet times, good equipment was produced in Belarus. Although maybe I'm wrong.
An original implementation of the system for switching on the binding of power blocks. To enable this mode, it is necessary to compress the housing at a certain point, and the micro switch inside will operate. But in the instructions this place is shown quite clearly, so I got the first time.
The first inclusion of the transmitter made the same a little nervous. When power was applied, nothing was lit on the board, although there is an LED on the board. I’m used to having power indicators on all devices. On this transmitter it is not. At first I even decided that the board did not work, and climbed the tester to measure the voltage. But everything seems to be in order. Then I downloaded the library from the site, and began to try examples. The LED blinks when sending a command. In this case, there is subtlety. He blinks not when receiving data on UART, but when sending a command on the air. This feature also made me nervous. Already during the development of the compiler, commands for power blocks suddenly stopped passing, and the LED stopped blinking. Although I clearly saw that the packages for UART go. I decided that I still burned him. It turned out that the error in the code, and the checksum, which is present in the package, I have calculated incorrectly. Accordingly, the transmitter did not receive this packet and did not send commands. After fixing the code, everything worked fine.
Now about the library, which is on the manufacturer’s website. I originally planned to use it. But picking with her, I realized that she did not suit me. Firstly, it does not support working with the LED Lena controller (SD111-180). Secondly, she does not know how to control the dimming mode for the power unit (SU111 300). And finally, it is nailed to SoftwareSerial. This is not always good. Still, in some cases, to save resources, it is better to use hardware UART. Therefore, I had to develop the code myself (naturally spying on the library implementation).
In all other respects, this equipment left a very good impression. It works stably, there are many possibilities, the quality is at a very high level. At a price of course higher than the usual equipment from China. But in China there are no analogues yet (at least I did not find the same complex), but in comparison with the far abroad countries where such systems are produced, the price is even very attractive.
Well, now let's look at the implementation of transmitter control through the FLProg program.
The transmitter is connected to the Arduino in accordance with the scheme.
The connection RX (Arduino) - TX (MT1132) can not be used, because I did not implement feedback from the transmitter to the controller (confirmation of sending a command). The exclusion of this connection allows using the hardware UART not to disconnect the transmitter when spilling the controller.
To control the transmitter in the FLProg program, the Noo Lite transmitter control block (Miscellaneous folder) appeared in the element library.
Sending a command to the transmitter occurs on the leading edge of the pulse at the “Send” input. A separate block can be used for each command, or the command can be specified by the value supplied to the Comand input.
Like everyone else, this block is configured using the block editor (called by double-clicking on the block transferred to the workspace of the circuit).
If you parameterize the first such block in the circuit, then you need to connect a new transmitter.
This will open the transmitter connection window.
In this window, you must specify the name of the transmitter and select the port to which it is connected. In the case of using SoftwareSerial, it is also necessary to select the pins for this port.
After connecting the transmitter, you must set the channel on which the command will be transmitted.
The channel can be set as a constant, so use the input for this. Accordingly, when using the input, the channel can be changed programmatically.
And finally, select the command to send.
List of supported commands:
- Bind receiver
- Untie receiver
- Enable load
- Turn off load
- Switch state
- Run smooth dimming
- Run a smooth increase in brightness
- Change the direction of a smooth change in brightness
- Stop fading
- Set brightness (0 - 120)
- Enable smooth color matching (only for LED strip controller)
- Switch color (only for LED strip controller)
- Switch operation mode (only for LED strip controller)
- Switch effect speed (only for LED strip controller)
- Set brightness for each channel (0-255) (only for LED strip controller)
- Remember state
- Set Saved State
You can also use an input to select a command (select “Input” in the list of commands) and in this case, you can change it during the program execution by sending the command number to the Comand input.
Team Numbers:
Team number | Command |
---|---|
0 | Enable load |
1 | Run smooth dimming |
2 | Turn off load |
3 | Run a smooth increase in brightness |
4 | Switch state |
5 | Change the direction of a smooth change in brightness |
7 | Set Saved State |
8 | Remember state |
9 | Untie receiver |
10 | Stop fading |
fifteen | Bind receiver |
16 | Enable smooth color matching (only for LED strip controller) |
17 | Switch color (only for LED strip controller) |
18 | Switch operation mode (only for LED strip controller) |
19 | Switch effect speed (only for LED strip controller) |
Please note that in this table there are no commands " Set brightness (0 - 120) " and "Set brightness for each channel (0-255) (only for LED strip controller)." To send these commands you must use a separate block. Let's look at these commands in more detail.
“ Set brightness (0 - 120) ” - when this command is selected, additional parameters will appear in the block editor.
Using these parameters, you can set the brightness value transmitted as a constant in the command, or use the input. In the second case of the input, the block “ Value ” appears
“ Set the brightness for each channel (0-255) (only for the LED strip controller)»- when you select this command in the block editor, additional parameters will also appear.
And just as in the previous command, the brightness value for each channel can be set as a constant, or use the input. At the same time, the block will have the corresponding inputs - " R ", " G ", " B "
Well, probably that's all, thanks for your attention.