This project aims to take through the steps involved in development of electronics subsystem of a Dispenser system by using a model-based design tool Altair Embed with an Arduino as the control unit.
By way of designing this simple system ground up there are some interesting insights that we would like to introduce to the readers especially highlighting some benefits that when approached through a hand coded approach may not be intuitive.
Based on the experience in designing this system we realized there are several stages that are important to leverage the full benefit of the model-based approach.
Here is a video series that should walk through all the steps that we took to develop the system .
Hardware and software Used:
Circuit Diagram:
Here we will be using an IR sensor to control an immersive pump and the control of the same is managed using the IR sensors inputs and a counter that maintains the sensitivity of the on and off cycles for the pump.
Simulation of the Logic using Altair Embed (Real and Non-Real time Simulation):
The Embed Diagram in the Fig 1 and 2 focuses on simulating first the logic of how our dispenser system should work and this is achieved using a state chart that is capturing the IR sensor input , accurately starting a counter and then waits to transition a state till it achieves the sensitivity values set on the diagram . A similar approach is carried out for the off time too.
Altair Embed allows a nice feature to single step through the simulation that kind of helps in knowing what is the current state and also what are the variables that are changing at each time step. In this way we could tune our system’s behavior very precisely which could be quite a challenge to achieve using a tradition hand code where it means one has to each time download the code onto the hardware and check.
Fig 1
Fig 2
Altair Embed also provides intuitive interfaces like the buttons that helps mimic the IR sensors output, this could also be taken further to may be also add a variable frequency signal. But for the simplicity we used a button to check if the on and off cycles are as desired.
Processor in Loop:
Once we know the overall logic is working as expected the next step was to do something interesting called the PIL where in the logic in this case the state chart runs on the hardware and we test our logic against PC inputs i.e. a Button. This is to ensure that the behavior that we see in the PC vs the hardware is matching.
Fig 3
Hardware in Loop:
Now comes the most interesting and the fun part. We now connect the IR sensor as well as the pump to the microcontroller and then run the diagram in Hardware in the Loop mode. In this case we can treat the PC side like an oscilloscope observing the signals as they function on the Arduino. This was a cool feature that I think that makes a life lot easy.
Fig 4
The video below should show the HIL behavior.
Deployment and Flashing:
Once we are happy with the overall simulation one can take the diagram and with relevant inputs and outputs connected deploy the algorithm on the hardware and of course experience the system working as we expect with a great confidence of our simulations till now.
Fig 5
Following is a prototype video of the overall system working with all the code generated using Model Based workflow with no requirement for C programming expertise.
Want to learn more and experiment you could now buy a copy of an annual Altair Embed Basic edition as used in this demo and develop your next project.
https://www.tenettech.com/product/altair-embed-basic-annual-single-user-license
Stay Tuned as we build more interesting projects of higher complexity and show in action the benefits of Altair Embed.