In the video, this section of the post starts at 7:15min mark and it is demonstrated using a simple LCD connection To rest an Arduino UNO board just click the Reset button which will reset the board to its initial state
In the video, this section of the post starts at 6:00min mark
To generate a HEX file for simulation, first, create a sketch and then save the
sketch inside a folder.
Next, compile the sketch using the tick button
After that Go to Sketch & click on
Export Compiled Binary to export the HEX file
Next, open any Simulation software like
Proteus which supports Arduino and create the circuit according to your sketch and link the HEX standard file by double-clicking on the
controller chip to simulate your circuit.
In the video, the serial monitor section begins @ 5:35min mark
To explain built-in serial monitor I have connected a Trimmer(pin1 to GND, center pin to A0 & pin 3 to 5V) to
the Arduino & powered it ON and uploaded the sketch AnalogReadSerial from the library
Now to open the serial monitor go-to tools
& click on Serial Monitor
Now as you can see when I adjust the
trimmer the value changes in the Serial Monitor. To get the values to the serial monitor you need few statements written in the sketch (detailed explanation can be found in the latter part of the post)
Important statements should be written and steps to take to get the values in the Serial Monitor
1. Serial.begin(9600);- this statement will always be declared inside theVoid Setup() {} & This initializes serial communication at 9600 bits per second. 2. Serial.println(); - This statement prints values in the Serial Monitor 3. In the serial monitor make sure that you set the baud rate to 9600 which will be in the right-hand bottom corner
In this post, I will show you how to add libraries to your Arduino IDE internally & externally.
Adding library internally (@4min mark in the video)
To add libraries go to Tools & select
Manage Libraries which will open the Library Manager
Under library manager, you can find all the
libraries which are installed or you can find various libraries for various
applications which you can install
If you find any libraries which are not
installed just click the install button to install it
Once the installation is complete close the
Library manager and re-launch the Arduino IDE
In this tutorial post, you will learn the basic of Arduino IDE & Arduino UNO. If you're interested in learning via video you can watch the below video which covers all the topics which are shared in this post.
Note: The video doesn't cover the explanation for the sketch
This post is helpful for people who are just getting started with Arduino and who have no knowledge of Arduino IDE or Arduino UNO.
About Arduino
Arduino is an open-source electronics platform that offers various kinds of Microcontroller boards and shields for various types of applications. Arduino also offers easy to use software. Arduino boards are capable of reading inputs from various sensors like LDR, LM35, Gas sensors & many more.
About Arduino UNO which will be used in this post
Source: Arduino Website
Arduino Uno is based on the microcontroller ATmega328P which is a high-performance Microchip 8-bit AVR RISC microcontroller combines 32KB ISP flash memory with simultaneously read-write capabilities, 1024 bytes EEPROM, 2KB SRAM, 23 I/O lines, 32 working registers, 3 flexible timer/counters with compare modes, Internal & external interrupts, serial programmable USART, a byte-oriented 2- wire serial interface, SPI serial port, and a 6 channel 10-bit A?D converter.
Arduino UNO has 14 digital pins of which 6 pins can be used as PWM outputs, 6 Analog Pins, Vin pin for input voltage, 2 GND points, a 5V pin, a 3.3V pin, a built-in LED for output which is associated to the PIN 13 of the UNO (built-in LED can be called in the sketch using LED_BUILTIN), a 16 MHz resonator, a USB connection for power and programming, a DC power jack, ICSP header & a reset button. The operating voltage of the Arduino UNO is 5V & the recommended input voltage is between 7 to 12V
To download the Arduino IDE click here & scroll down and select the Arduino IDE according to your OS. Once the download is complete, extract the files from .zip folder and open the extracted folder & click on Arduino executable file which should open the Arduino IDE. Arduino website now also offers a web-based editor which you can check by clicking here.
Running First Sketch
To run the first sketch first connect the Arduino UNO to a laptop or a desktop and then open the Arduino IDE
After opening the IDE go to Tools > Board > & select Arduino UNO
Next, go to the Port > select your COM port.
Next, let's upload the example sketch which comes along with Arduino IDE. To upload the example sketch go to File > Basics and select Blink Sketch
Next, click on Verify to compile the sketch
and then click on upload button to upload your sketch to Arduino UNO
Now if your upload is successful you can see TX, RX LED's rapidly flashing
and then the L LED will start blinking.
How to connect external components with Arduino UNO Take a breadboard and mount 220-ohm resistor and connect +ve lead of the LED to one end of the resistor, next connect two breadboard wires to the outer end of the circuit as shown in the below image
Next, connect the Red wire to Pin 9 and Black wire to the GND pin. After making the connections connect the Arduino UNO to a laptop or desktop and open the Arduino IDE and then follow the process showed in "Running First Sketch". Note: For this example, you need to use the sketch Fade which is under File > Examples > Basics > Fade
Sketch Explanation for sketches used in this post Blink Sketch: Blink is an example sketch which comes with Arduino IDE
Sketch End Sketch Explanation - Blink void setup() {}-Setup function runs when you power the board or press reset button. void loop() {}-Loop function runs statements inside it over and over again forever pinMode(LED_BUILTIN, OUTPUT); -declaring the built in digital pin LED_BUILTIN to Output
digitalWrite(LED_BUILTIN, HIGH);- This turns the LED ON (Voltage = +5V)
digitalWrite(LED_BUILTIN, LOW);- This turns the LED OFF (Voltage = 0V)
delay(1000); - delays execution of next statement by 1second(1second = 1000milli Second)
Fade Sketch: Fade is an example sketch which comes with Arduino IDE Sketch Start
int led = 9; int brightness = 0; int fadeAmount = 5; void setup() { pinMode(led, OUTPUT); } void loop() { analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness <= 0 || brightness >= 255) { fadeAmount = -fadeAmount; } delay(30); }
Sketch End Sketch Explanation - Fade int led = 9; - assigning PIN 9 to LED
int brightness = 0; - Assigning the brightness of the LED at the start
int fadeAmount = 5; - Points to fade the LED by
brightness = brightness + fadeAmount; -changing the brightness for the next time when it goes through the loop. Lets see the iteration of the this statement
1st Iteration brightness = 0 + 5; - so brightness = 5 Now2nd Iteration brightness = 5 + 5 - at the end of 2nd Iteration the brightness = 10. this will continue until the brightness value becomes 255
if (brightness <= 0 || brightness >= 255) {fadeAmount = -fadeAmount;} - this reverse the direction of fading at the end the fade.
A detailed explanation of the IF Statement
if (brightness <= 0 || brightness >= 255)this translates to 'if brightness is less than or equal to zero OR brightness greater than or equal to 255 enter inside or get out'
When brightness reaches the value 255 one of the conditions inside the IF statement (brightness >= 255) becomes true and goes through the IF statement.
Once inside the IF statement, the statement fadeAmount = -fadeAmount; assigns a new value to the fadeAmount which is -5 and then exists the IF statement
So now brightness = 255 + (-5);and this Iteration will continue until brightness reaches 0 when this happens it enters the IF statement once again since the condition brightness <= 0becomes true and the new value for the fadeAmount will be assigned which now becomes +5 since negative multiplied by negative is positive and this cycle goes on forever
In this post, I will show you how to make a custom DIY temperature meter using bar graph & Atmega328p
Below is the circuit diagram which was created in KiCAD for this project which includes parts like
1*Atmega328p
1*Bar Graph
1*10K Ohm
10*220 Ohm
1*LM35
1*Terminal Block
2*22pf Ceramic Capacitor
1*16 MHz Crystal
1*Custom Made PCB by JLCPCB.com
Theory
The main section of the circuit (Atmega328p, 22pF Ceramic Capacitor, 16MHz Crystal, 10K ohm) is the downsized version of the Arduino UNO The input section of the circuit is an integrated analog temperature sensor whose electrical output is proportional to Degree Centigrade (LM35). The output of the LM35 is connected to pin 23 of the Atmega328p.
The output section is the remaining section of the circuit which includes Bar graph and 10*220 ohm resistor
The below section of the sketch is where all the variables are declared and initialized
float val;
float tempPin = A0;
int ledCount=10;
int thisLed;
int ledPin[] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 12
};
int ledON=HIGH;
int ledOFF=LOW;
void setup()
{
Serial.begin(9600);
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPin[thisLed], OUTPUT);
}
}
In this section of the sketch, the analog data is converted to the readable format
val = analogRead(tempPin); //to read the data from the LM35 float mv = ( val/1024.0)*5000; //Converting the input voltage to digital value (b/w the range 0 to 1023) float cel = mv/10; //Converting to celcius float farh = (cel*9)/5 + 32; //Converting to Fahrenheit
In the next section of the sketch, the converted value is passed through a number IF loop to determine how many LED lights should be turned ON
The next section of the sketch is optional. This section is to see the temperature in the built-in serial monitor of the Arduino IDE
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
/* uncomment this to get temperature in farenhite
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
*/
}
After receiving the fabricated PCB board I mounted all the components as per the circuit diagram & tested the circuit
Comparing my circuit result to a commercially available temperature meter
In this post, I will show you how to convert an old laptop screen to a portable TV
To convert your old laptop screen to TV, first remove the bezel covering the LCD panel.
After removing the bezel note down the model number of the LCD panel and then place an order for the compatible LCD controller board Tips: While placing the order ask the vendor to connect all the connections or ask for the guide
Next, I connected 4 Ohm 3 Watt speakers to the LCD controller board. Since I could not find suitable JST connector I had to hardwire the speaker connection through the backside of the panel