Saturday, June 19, 2021

Arduino IR simulator projects - "simple receiver"

Arduino "IR simple receiver" on Arduino simulator - IR remote project

 Summary

Arduino "simple receiver" is an Arduino project involving IR receiver and IR remote. 

Wokwi Arduino simulator is used here as it is free and easy to use online. 

wokwi Arduino simulator - IR remote simple receiver project
Wokwi Arduino simulator - IR simple receiver project

 

You can do following things with the Arduino Simulator example

  • Can you add more features to the project so that each remote button will have a real function (servo motor turning or LED on off etc)?

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Sunday, June 13, 2021

Arduino Simulator Example - "LED bar graph" πŸ“Š

Arduino "LED Bar graph" on Arduino simulator

 Summary

Arduino "LED bar graph" The bar graph - a series of LEDs in a line, such as you see on an audio display - is a common hardware display for analog sensors. It's made up of a series of LEDs in a row, an analog input like a potentiometer.

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: Always connect a resistor of about 220 ohms in series with the LED. Do not connect them directly to the Arduino Pin.

Wokwi Arduino Simulator - LED bar graph project
Wokwi Arduino Simulator - LED bar graph project


You can do following things with the Arduino Simulator example

  • Can you make two columns instead of one?

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - "ASCII Table"πŸ’Š

Arduino "ASCII table" on Arduino simulator

 Summary

Arduino "ASCII table" presents the more featured serial printing options by printing on the serial monitor a list of characters and the corresponding ASCII values in decimal, hexadecimal, octal, and binary. For more on ASCII, see asciitable.com and http://en.wikipedia.org/wiki/ASCII

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: Always connect a resistor of about 220 ohms in series with the LED. Do not connect them directly to the Arduino Pin.

Wokwi Arduino simulator - ASCII table print


You can do following things with the Arduino Simulator example

  • Print your name in ASCII

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator Example - "Analog Write with 12 LEDs on an Arduino Mega" πŸ•―

Arduino "Analog Write with 12 LEDs on an Arduino Mega" on Arduino simulator

 Summary

Arduino "Analog Write with 12 LEDs on an Arduino Mega" gently fades 12 LEDs connected to the Arduino Mega board. The LEDs are connected from pin number 2 to pin number 13 (in total, 12 LEDs). This is made possible due to the fact that, we have increased number of PWM pins. Let's get started.

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: Always connect a resistor of about 220 ohms in series with the LED. Do not connect them directly to the Arduino Pin.

Wokwi Arduino Simulator - Arduino Mega and 12 LEDs
Wokwi Arduino Simulator - Arduino Mega and 12 LEDs


You can do following things with the Arduino Simulator example

  • Can all the LEDs can be faded ON and OFF at the same time?

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - "Pitch follower using the tone() function" 🎡

Arduino "Pitch follower using the tone() function" on Arduino simulator

 Summary

Arduino "Pitch follower using the tone() function" program creates different tones based on the value read on the Analog input(). In this example, A potentiometer is connected to the Analog input A0. The buzzer is connected to Pin 8. You can always get the connection diagram for the project in the simulation window below. Let us get started!

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Pitch follower example
Wokwi Arduino Simulator - Pitch follower example


You can do following things with the Arduino Simulator example

  • Can you inverse the logic? higher the value, lower the tune and vice versa?

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - "Playing tones on multiple output" 🎼🎷

Arduino "Playing tones on multiple output" on Arduino simulator

 Summary

Arduino "Playing tones on multiple output" Program creates tone on three connected buzzers. They are connected to pin 6, 7, and 8 of the Arduino.

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Playing multiple tones on Arduino simulator
Wokwi Arduino Simulator - Playing multiple tones on Arduino simulator

 

You can do following things with the Arduino Simulator example

  • Can you come up with a known tone and play it here?

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 


Arduino Simulator Example - "Simple Keyboard using tone() function" πŸͺ•πŸŽΆ

Arduino "Simple Keyboard using tone() function" on Arduino simulator

 Summary

Arduino "Simple Keyboard using tone() function" Program creates different tone based on which button is pressed. In this case, we have three buttons connected to the the UNO board. You can find more helpful information on Arduino official website. Let us get started.

Three buttons are connected to three analog port pins - A0, A1, A2. Here we have connected three potentiometers. if the value read by the analog read function is higher than the set 'threshold', the tone will be activated. Goahad and make your own version out of it!

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Simple keyboard using tone() function
Wokwi Arduino Simulator - Simple keyboard using tone() function

 

You can do following things with the Arduino Simulator example

  • Just have one potentiometer connected. Vary the tone based on the value read by the Analog input.

Arduino Simulation

In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Saturday, June 12, 2021

Arduino simulator examples - "StateChangeDetection" πŸ•΅️‍♂️

Arduino "Internal pull up example" on Arduino simulator

 Summary

Arduino "Internal pullup" Program toggle the connected LED when the button is pressed. also, the status of the button is printed on the serial terminal. This example showcases to you how you can use an internal Arduino pull-up to hold the floating input pins to a known state. They are called weak pull-ups. when the button is not pressed, the digital pin will read a logic 1. When the button is pressed, the pull-up cannot influence any more and the voltage read at the digital pin is very close to zero. This will be read as logic 0 by the digital read function.

Use the information in the tips for more clarity. Click on the Run button in the simulator below to see the Arduino simulator in action. 

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - State Change detection
Wokwi Arduino Simulator - StateChangeDetection

 

Tip✅: The document here has good information of bouncing and debouncing of the mechanical switches. 


Tip✅: Always have a resistor connected in series with the LED to avoid burning the LED or damaging the GPIO pin.

You can do following things with the Arduino Simulator example

  • Only print the button state when there is a change in the state

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino simulator examples - "Play a melody using the tone()" 🎡

Arduino "Play a melody using the tone()" on Arduino simulator

 Summary

Arduino "Play a melody using the tone()" Plays the melody on a buzzer connected to one of the digital output pin of the Arduino UNO. Click on the Run button in the simulator below to see the Arduino simulator in action. The buzzer is connected to pin number 8 of the Arduino UNO.

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Play a melody using the tone()
Wokwi Arduino Simulator - Play a melody using the tone()

 

You can do following things with the Arduino Simulator example

  • Can you play more tones?

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino simulator examples - "Internal Pullup" 🀸‍♂️

Arduino "Internal pull up example" on Arduino simulator

 Summary

Arduino "Internal pullup" Program toggle the connected LED when the button is pressed. also, the status of the button is printed on the serial terminal. This example showcases to you how you can use an internal Arduino pull-up to hold the floating input pins to a known state. They are called weak pull-ups. when the button is not pressed, the digital pin will read a logic 1. When the button is pressed, the pull-up cannot influence any more and the voltage read at the digital pin is very close to zero. This will be read as logic 0 by the digital read function.

Use the information in the tips for more clarity. Click on the Run button in the simulator below to see the Arduino simulator in action. 

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: The document here has good information of bouncing and debouncing of the mechanical switches. 


Tip✅: Always have a resistor connected in series with the LED to avoid burning the LED or damaging the GPIO pin. 

wokwi Arduino Simulator - Internal pull-up
wokwi Arduino Simulator - Internal pull-up

You can do following things with the Arduino Simulator example

  • Only print the button state when there is a change in the state

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino simulator examples - "Debounce button" πŸ₯

Arduino "Push button example with debounce" on Arduino simulator

 Summary

Arduino "Push button example with debounce" Program toggle the connected LED with every click. Without the debounce feature, most of the mechanical buttons will create a random output for short intervals. Using this debounce feature in the software, you can arrest the erratic behaviour and make the user experience better. Note that, even in the simulator, the bounce feature is available. You can enable or disable the noise on the buttons. use the information in the tips for more clarity. Click on the Run button in the simulator below to see the Arduino simulator in action. 

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: The document here has good information of bouncing and debouncing of the mechanical switches. 

Wokwi Arduino Simulator - Debounce button example
Wokwi Arduino Simulator - Debounce button example

You can do following things with the Arduino Simulator example

  • How will you address the bounce in hardware?
  • can you vary the strength of the debounce in software?

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - "Push button input" πŸ”˜

Arduino "Push button example" on Arduino simulator

 Summary

Arduino "Push button example" Program lit the connected LED as long as the push button is activated. Push buttons are also called momentary buttons. You can see that, the push button is connected to pin number 2 of the Arduino Mega. The functions used to read the push button should be very familiar as well. 

As long as you hold the push button pressed, the LED will be ON. Once you release the button, the LED will be off. In order to avoid the spurious behavior due to debounce, the bounce feature is disabled in the simulation. In real world, you will be problem with bounce and you should address it as well using You can click on Run button in the simulator below to see the Arduino simulator in action. 

Wokwi Arduino simulator is used here as it is free and easy to use online. 

Tip✅: The document here has good information of bouncing and debouncing of the mechanical switches. 

Wokwi Arduino simulator - push button input
Wokwi Arduino simulator - push button input

You can do following things with the Arduino Simulator example

  • Can you introduce noise (enable bounce in the simulation as well)? reference
  • How will you address the bounce in software?

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - Blink without delay ⏳

Arduino "Blink without delay" on Arduino simulator

 Summary

Arduino "Bink without delay" Program blinks the connected LED, but without using the standard delay function. This will help you to spend time with the tasks.  Instead of simply waiting for 500 ms or 1000 ms to change the state of the LED, you can do other tasks, while checking intermittently the time elapsed between last state change.

You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Blink an LED
Wokwi Arduino Simulator - Blink an LED

 Tip✅: The LED needs a resistor in series in practical circuits. 

You can do following things with the Arduino Simulator example

  • Blink an LED connected to pin 13 every 1 second, and another LED connected to pin 12 every 100 ms.

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator Examples - "Read Analog Voltage" πŸ“ˆ

Arduino "Read analog voltage" on Arduino simulator

 Summary

Arduino "Read analog voltage" Program reads the value of the ADC for the selected channel. The Potentiometer is an easy to use device to generate analog voltages from 0 V up to 5V. The Analog input A0 is used on the UNO for this specific example.

You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Read Analog voltage
Wokwi Arduino Simulator - Analog read voltage

 

Tip✅: The ADC resolution is set to 10 bit by default to match UNO. Other Arduino boards have different (higher) resolution. You have dedicated functions to set the desired ADC resolution.

You can do following things with the Arduino Simulator example

  • Blink the LED (on board LED, pin 13) whenver the ADC value is higher than 2.5 V

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator examples - "LED fading" -using AnalogWrite() πŸ“‰

Arduino "Fade an LED" on Arduino simulator

 Summary

Arduino "Fade an LED" Program fades an LED. The LED in this example is connected to pin 9 of the Arduino UNO. The fading is achieved by driving the LED at a constant PWM frequency but variable Duty cycle. The example is taken from standard builtin Arduino example. 

You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Warning🚨: Make sure you connect a resistor in series when you connect an LED to a real board. If not, you may damage the LED or the Board or worse, both!  

LED fading - Wokwi Arduino Simulator
Wokwi Arduino Simulator - AnalogWrite() function for LED fading

 

Tip✅: Red LEDs will have lower forward voltage compared to blue or white LEDs. Hence, Red LEDs need a higher value of resistor in series compared to a white LED for the same brightness.

You can do following things with the Arduino Simulator example

  • Add one more LED on pin 10 and make both LEDs fade together

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino simulator examples - "Blink an LED" πŸ’‘

Arduino "Blink an LED" on Arduino simulator

 Summary

Arduino "Blink an LED" Program blinks an LED. The LED in this example is connected to pin 13 of the Arduino UNO. There is also an onboard LED. You, to try this example on real board/simulator you don't have to really connect an LED externally. You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Blink an LED
Wokwi Arduino Simulator - Blink an LED

 

Warning🚨: Make sure you connect a resistor in series when you connect an LED to a real board. If not, you may damage the LED or the Board or worse, both!  

Tip✅: Red LEDs will have lower forward voltage compared to blue or white LEDs. Hence, Red LEDs need a higher value of resistor in series compared to a white LED for the same brightness.

You can do following things with the Arduino Simulator example

  • Change the LED blinking frequency to 10 Hz
  • Change the color of the LED
  • Add one more LED on pin 12 and make both LEDs blink together
  • Change one of the LED to a different color and blink the two LEDs alternatively. 

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Arduino Simulator Examples - "Serial Plotter" πŸ“Š

Arduino "Serial Plotter" on Arduino simulator

 Summary

Arduino "Serial Plotter" Program plots the data given on a horizontal axis. It helps a lot to use this feature while working with microphone, potentiometers or analog sensors to visualize the data. You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Serial plotter
Wokwi Arduino Simulator - Serial plotter

 

The X axis in the serial plotter represent time and each unit presents how fast the serial print was called in the code. The Y axis in the Arduino serial plotter  represents amplitude and it will scale automatically based on the value being printed. 


Tip: Click on the plotter button above on the serial monitor window

You can do following things with the Arduino Simulator example

  • Change the wave to sine wave (Tip: uncomment the particular code line in the example)
  • Change the speed at which the plot happens

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

Friday, June 11, 2021

Arduino simulator examples - "Serial Transmission of data" πŸ“Ί

Arduino "Serial transmission" on Arduino simulator

 Summary

Arduino "Serial transmission" Program prints the text "Arduino simulator" on the serial terminal in a loop. You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino Simulator - Serial transmission of data
Wokwi Arduino simulator - serial transmission of data example

 

You can do following things with the Arduino Simulator example

  • Print your name along with a counter value which increments for every counter 
  • Can you generate nice patterns using symbols = *, $ and #?
  • Can you again delete "ln" from the "Serial.print" command and see what happens?

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the code and recompile it by clicking on rerun/Run button. For more help, please visit Discord channel of the Wokwi Arduino Simulator. 

2

Arduino simulator examples - "Hello World" program πŸ‘‹

Arduino "Hello World" on Arduino simulator

 Summary

Arduino "Hello World" Program prints the text "Hello World" on the serial terminal once. You can click on Run button in the simulator below to see the Arduino simulator in action. Wokwi Arduino simulator is used here as it is free and easy to use online. 

Wokwi Arduino SImulator - Hello World - Simulation
Wokwi Arduino Simulator - "Hello World"

 

You can do following things with the Arduino Simulator example

  • Print your name on the Arduino serial terminal 
  • change the baud rate and try the examples again
  • Remove "ln" in the "Serial.println" command and see what happens
  • Can you Change UNO to Arduino Mega?

Arduino Simulation

 In the section below, you can also modify the code and see the results instantly. You can change the text you want to display. Also experiment with printing variables as well. For more help, please visit Discord channel of Wokwi Arduino Simulator. 

Arduino IR simulator projects - "simple receiver"

Arduino "IR simple receiver" on Arduino simulator - IR remote project  Summary Arduino "simple receiver" is an Arduino p...