# Automation HAT with Simulink

**URL:** <https://forums.pimoroni.com/t/automation-hat-with-simulink/7788>\
**Category:** Raspberry Pi\
**Created:** [May 25, 2018, 1:29am UTC](https://forums.pimoroni.com/t/automation-hat-with-simulink/7788 "2018-05-25T01:29:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![i621148](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@i621148](https://forums.pimoroni.com/u/i621148)\
**Post date:** [May 25, 2018, 1:29am UTC](https://forums.pimoroni.com/t/automation-hat-with-simulink/7788/1 "2018-05-25T01:29:08Z")

</div>

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](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](https://www.mathworks.com/help/supportpkg/raspberrypi/blocklist.html?s_cid=doc_ftr)

I am guessing from this picture that:  
 ![](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/f/f4ac2d2ec4812deb83b845b53d224877cd477171.jpg)  
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 :)

---

<div class="post-metadata">

**Author:** ![i621148](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@i621148](https://forums.pimoroni.com/u/i621148)\
**Post date:** [May 25, 2018, 1:56am UTC](https://forums.pimoroni.com/t/automation-hat-with-simulink/7788/2 "2018-05-25T01:56:31Z")

</div>

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](https://photos.app.goo.gl/XVPAVSX2LIdRBt2K3)
