In Matlab command window type arduinosetup and press enter. Plug the Arduino Uno into the computer using the USB cable.
If your version of Matlab is different from mine and when you go to open the Simulink project and you get giving out to by Matlab due to not having some other library installed in order to open the project just go back and search for the library and install it as at this point for me all other needed library’s are installed by default. Next search for Simulink Support Package for Arduino Hardware and see if its installed if not install it if your licence allows it.Īt this point if all of the above is installed you should be good to go with the rest of the project. In the new window search Stateflow and see if its installed if not install it if your licence allows it. A new window will open and we can check if we need to install the Add On’s needed for this project. In the toolbar section expand Add-On’s and click on Get Add On’s. Now right click the created folder and select -> Add to path -> Selected Folder and Subfolders.Ĭlick into your created folder to load a blank work space for the project. The RGB package will cycle through pattern 2 and remember the last time period set by the Potentiometer.Īnalog A0 Input Voltage _ On-Off Timeģ.75 V New -> Folder and give it a name. When switch 1 and 2 are low (pressed) the single Blue Led will be low (off) and the LDR will be selected as Analog input (A1) to be read by the ADC, this reading will be used to set the single Red Led on or off (on if dark detected, off if light detected), it will now also set a time period to run the buzzer at a certain frequency ( if light detected buzzer freq = 40 Hz, if dark detected buzzer freq = 20 Hz).The RGB package will cycle through pattern 1 and remember the last time period set by the Potentiometer. When only switch 2 is low (pressed) the single Blue Led will be low (off) and the LDR will be selected as Analog input (A1) to be read by the ADC, this reading will be used to set the single Red Led on or off (on if dark detected, off if light detected).When only switch 1 is low (pressed) the single Blue Led will be high (on) and the Potentiometer will be selected as Analog input (A0) to be read by the ADC, this reading will be used to set a time period (see table 1) to cycle through a pattern on the RGB Led package (Pattern 2 = All Off->Red->Green->Green, Red->Blue->Blue, Red->Blue, Green->Blue, Green, Red and repeat).When switch 1 and 2 are high (not pressed) the single Blue Led will be high (on) and the Potentiometer will be selected as Analog input (A0) to be read by the ADC, this reading will be used to set a time period (see table 1) to cycle through a pattern on the RGB Led package (Pattern 1 = Red->Green->Blue->Green and repeat).slx for the Simulink project which can be downloaded and opened in Matlab. RGB Led package (RGB Led Red D9, Green D10, Blue D11).Arduino Uno pin out diagram, handy to have at hand to reference hardware connections.Ĭomponents used on Easy Module shield and connections to Arduino Uno:.Computer or laptop with Mathlab, Simulink installed with add on’s, Simulink Support Package for Arduino Hardware, Stateflow.Keyes Easy Module Shield V1, or similar as there are variants that are exactly the same.USB Cable, for Arduino to connect to computer or laptop.Arduino Uno, or similar development board.
The Mathlab version used in this project is R2018b free student download with academic license used on a Windows 10 machine. This project will assume that people have experience with Arduino, electronic circuits and components, some programming knowledge and will also assume some experience with Matlab and Simulink. We will be using the Keyes Easy Module Shield to build a project so an user can interact with and visually see a response from the project created in Simulink.
This is an how to in how to program the Arduino Uno using Matlab and Simulink.