Showing posts with label schematic. Show all posts
Showing posts with label schematic. Show all posts

Sunday, December 20, 2020

Reading Potentiometer value using Arduino - Software Loading into Arduino and Demo

 In earlier article we have seen the software creation using pure Simulink with out using any Stateflow for reading and displaying the potentiometer value. In this article we will explore the software deployment, circuit diagram and demo.

Schematic for reading potentiometer value using Arduino

 Potentiometer wiper is connected to the Arduino analog pin 2, 5V power and ground is supplied from Arduino. Three LED's are connected to the Arduino digital pin 3,4 and 5 to display the potentiometer reading in binary format. When the processed analog value is 1 only first LED will be turned on and rest all LED's are turned off. So these three LED's represent the three bits of the binary number.

Software deployment to Arduino from Simulink 

Following video presents the steps required to prepare the Simulink model for code generation for the Arduino board. The steps for the code generation are same as the steps explained in this article


 Demo for Potentiometer value reading using Arduino


As you can see in the demo video the potentiometer value is read by the Arduino using the analog pin 2 and then process it and displayed the mapped value using three white LED's.

I hope you enjoyed the article and we will catch up in our next article where we will discuss the traffic lights simulation for four junction signals.

Saturday, December 19, 2020

LEDs Sequential lighting - Software Loading into Arduino and Demo

 In the previous post we have seen the developing of the software for the LED's sequential lighting using Stateflow. In this article we will explore the circuit diagram for the LED's sequential lighting and software deployment parts.

Schematic for Arduino and LED's Sequential Lighting

Following is the circuit diagram for the LED's sequential lighting using Arduino.

Arduino digital pin 3 is connected to the Red LED anode, digital pin 4 is connected to the Green LED anode and digital pin 5 is connected to the Yellow LED's anode. All the LED's cathodes are connected to the ground via a resistor. This resistor is used as current limiting resistor to limit the current draw from Arduino and saving the micro-controller from frying up.

Software deployment to Arduino from Simulink

Following video presents the steps required to prepare the Simulink model for code generation for the Arduino board. The steps for the code generation are same as the steps explained in this article

Demo for the LED's Sequential Lighting using Arduino

The following video shows the demo of the article on the Arduino Mega hardware, you can see the working of software created in earlier article


I hope you enjoyed the LED's sequential lighting demo in this article and in our next article we will explore the potentiometer interfacing with Arduino.

You can checkout how the LED's Sequential Lighting can be implemented using C programming language and Arduino IDE in this article.


Sunday, December 13, 2020

LED Blinking using Arduino and Matlab - Software Loading into Arduino and Demo

 In previous post we have seen the steps to create the Simulink model for the LED Blinking. In this post we will learn about configuring and preparing the model for code generation and deployment to the Arduino board.

Steps for preparing the Simulink model for deployment to Arduino

 The following steps help you to prepare the model for the deployment to the hardware in our case Arduino board.

  • Open the model configuration parameters from the Simulation window or select the little triangle icon beside gear icon in the tool bar and select "Model Configuration Parameters"
  • Select the "Hardware Implementation" option from the right options pane
  • Next choose the "Hardware board" from the drop down list available in our case we will select the Arduino. It can be either Arduino UNO or Arduino Mega 2560 based on your board.
  • Click save for the model configuration parameters.
  • Select the C/C++ Code from the Code menu and then click on Deploy to Hardware option or you can simply press Ctrl+B to deploy the software to the hardware board.
  • After successful code generation the code generation report will be opened automatically and you can browse the code from the simple HTML window popped up. 
  • MATLAB automatically generated the hex file for the Arduino board and deploys it using the connected USB cable.

All the above listed steps are explained in the following video.


 Schematic

 The Arduino schematic is developed using Fritzing software and is as follows, Arduino digital pin 9 is connected to the anode of the LED and the cathode of the LED is connected to the ground via current limiting resistor.

LED Blinking Demo using Arduino

You can check the following video for the LED Blinking demo, as you can see in the video the LED blinks with 0.5sec cycle.


 I hope you enjoyed the LED Blinking project using Arduino, Simulink and Stateflow.

Reading Potentiometer value using Arduino - Software creation using Ardino IDE and C Programming Language

 In previous article we have seen the steps in creating the software for the reading Potentiometer value using Simulink for Arduino board. ...