News

Fishtank

Aug 15, 2019. Busy with the make of a control for a fish tank. At the moment i have made a basic set of controlblocks and made the functionallity for the lightning (3 groups). started this week with a base for the control, check the movie!
In the movie a lot of the possibilties of the AFSM are presented, like the masking and forcing of I/O, the presentation of fully automatical or manual mode. New in the standard is made the presentation of the FSM mode and the uptime of the board in the dashboard part of the HMI screen. Lot of challanges; what is the best level transmitter, what sort of extra instruments do i need...?

Click here for the movie fishtank control

 

 

0
0
0
s2smodern

PID control

Just for fun, i started this project with a demo of a PID control. The proces is simple; take two plastic boxes, half full water and mount 2 pumps and a ultrasonic device for measuring the volume of water in one of the boxes. For a PID control you need at least a setpoint, a procesvalue, the parameters for the controller (P, I, D actions) and the ibrary for the PID control and the "field". The picture below is the P&ID (proces instrumentation diagram):

PID Test V0.0 PID

It is very simple and easy to explain (... and not very usefull but a nice example for a PID control). P02 (pump 2), is pumping the water from Tank 02 into Tank 01 with a predifined speed. P01 (pump 1) has to keep the same volume into Tank 01 by means of the PID-control. P02 can be set on different fixed outputs, so P01 has to control speed to keep te same volume in Tank 01. The volume is measured by the LT called DM1. DM1 is the ultrasonic device above Tank 01 and measures the distance of the sensor to the water surface (and so the volume in tank 01).

Some info about the hardware:

  • For the pumps i used two 12Vdc pumps
  • For regulating the pumps one L298N Dual H bridge stepper motor control
  • The HC SR04 Ultrasonic device
  • Some plastic hoses and 2 plastic boxes of about 2 ltr each.
  • The PID-1.2.0 library and the AFSM standard software
  • A serial to UBS converter to communicate with HMI

 

UserConfiguration.h 

UserConfiguration

 

UserFinitestateMachine.h

PID start

 

Explanation for "START" state:


In the start state the setpoint and the parameters for the controller are set. An array is filled to get rid of some disruptions from the Ultrasonic device. The average of 5 measurements is used as Process value for the control. Also pay attention for the controller direction. A "reverse" control means; when the input is accending the output of the control has to do same. In this case; when the level in Tank 1 is going up, P01 has to speed up for keeping the setpoint level. The opposite of "reverse" is "direct". For example an autopilot in a car; when the speed is dropping, the motor has to increase power to keep the disired speed.  
When the "START" button is pressed; the state will got to "REGULATE".

 

PID Regulate

Explanation of "REGULATE" state:

Every 200ms the input is measured and the output value is calculated by the PID control. After computing the ouput, it is set as a PWN value for the H bridge for P01. The output will only be set when it is greater then 155. If the value is lower than 155 the pump is not producing water. EN1 is set to command -start- P01 in the positive direction. If the "STOP" button is pressed, the state is again set to "START" (PID control is stopped).

 

How does it look on the plotter:

Red is the PV, process value; water level
Blue is the ouput of the controller; P01
Orange is the ouput of the fixed pump; P02

PID Sinus Stap

The plot show a flat line -with some noise- for the water level (as expected for this controller)

 

... and the installation of it on photo:

 PID foto

 

Initial HMI screen:

PID HMI

 

The states 25, 50, 75, 100 are run in a second FSM thread, parallel on the PID control thread. Every 5 minutes P02 is set on a new speed. As you can see in the plotter screen, P01 is following this "disturbance". For example, see the P02 states below. At the end of state "100", the thread is stopt; transition to the "END" state. P02 is stopt.

PID Pomp02

 

 

 

 

 

 

0
0
0
s2smodern

 

ssl https

 

The site is no longer categorized as "unsave website". Data is from today (may 18) encripted via SSL.
The official web adres is now https://www.jbsiemonsma.nl.

 

 

0
0
0
s2smodern

Raspberry HMI

 

  • The Python3 program for the serial connection with the MEGA board is now also capable of presenting and forcing Markers. Until now only DI/DO/AI/AO, Ultrasonics and TT's where possible tags.
  • Also extra is the presentation of tooltips under the tagnames. When clicking on the tagname, extra hardware information is presented (like e.g. the used hardware pin number). The info is automatic obtained from the MEGA board with the GMI metadata message.
  • Next step will be the writing of other variable types like AI/AO, TT and markers to the MySql database on the Raspberry PI3b. At the moment it is only possible to write digital IO to the MySql database.

 

The new software is available in the download part.

Example sketch: The floor lamp 

Tooltip

 

 

 

0
0
0
s2smodern

AFSM 2.6 Available.

The new software for the AFSM is now availble! The main changes are in the new Configurator. The software is also available under the Software part of the website. Find the description of the Configurator under Menu/Declaration part or click here.

 

CV005

 

0
0
0
s2smodern