Automation HAT with Simulink


#1

Greetings,

I am using the Pimoroni Automation Hat on a Raspberry Pi 3.
I have interfaced with Simulink to the Raspberry Pi 3 and can turn an LED on & off using this tutorial:
https://www.mathworks.com/help/supportpkg/raspberrypi/examples/communicating-with-raspberry-pi-hardware.html

Simulink has a very specific set of communication blocks which include writing to GPIO 17, GPIO 18 & GPIO 21. Can I use any of these blocks to turn off and on Relay 1, 2 or 3?

A full list of available blocks is listed here:
https://www.mathworks.com/help/supportpkg/raspberrypi/blocklist.html?s_cid=doc_ftr

I am guessing from this picture that:


GPIO 13 powers on & off Relay 1
GPIO 19 powers on & off Relay 2
GPIO 16 powers on & off Relay 3

Thank you for any help as I am a mechanical engineer by trade :)


#2

So this is going to become more of a tutorial for someone that wants to do it because I just double clicked the GPIO block parameters and changed the GPIO number to 13.

I had hooked some of my son’s Robotix motors to COM and NC of Relay 1 and it works!

Movie link below:
https://photos.app.goo.gl/XVPAVSX2LIdRBt2K3