Moving Light Display Arduino Project for Beginners

This easy Arduino project for beginners can be built on an electronic breadboard and uses only four LEDs and four series resistors to make a moving light display. The Arduino sketch for the project can be modified to change the rate at which the pattern on the LEDs is updated. The patterns to display on the LEDs can also be changed.

Moving Light Display Arduino Project for Beginners

Moving Light Display Arduino Project for Beginners

Details of this Arduino Project for Beginners

A breadboard is used to connect four LEDs with series resistors to an Arduino which can be an Arduino Uno or other Arduino. Four wire links connect the LEDs to four of the Arduino pins which are set as outputs. A common GND wire from the Arduino is connected to the breadboard which connects the other side of each of the series resistors to GND. This completes the circuit and enables the LEDs to be switched on by the sketch running on the Arduino.

Moving LED Arduino Project

Moving LED Arduino Project

The full project includes the circuit diagram, Arduino sketch code and instructions on how to modify the sketch to display different moving light LED patterns on the LEDs.

Other Arduino Beginner Project Resources

Those new to Arduino may be interested in the beginners electronics series of tutorials that includes an introduction to Arduino.

The same tutorial series includes ten Arduino projects for absolute beginners which is a sample of various Arduino built-in examples with instructions on how to build each project.

Installing Arduino Software and Drivers in Windows 10

There are some choices to be made when installing Arduino software and drivers in Windows 10. Arduino offer two ways of installing the Arduino IDE on a Windows PC — Windows installer file and a Windows zip file. Windows 10 will also install a default driver when an Arduino is plugged into the USB port of a PC. This driver can be replaced by the Arduino driver that comes with the Arduino software.

Arduino Software and Drivers

Installing Arduino software using the Windows zip file is the simplest method of installing the software. It is just a matter of copying the folder out of the downloaded zip file into the desired location on the PC. This allows the software to easily be removed by deleting the folder.

When Windows 10 installs a driver automatically, the Arduino just looks like a COM port in Windows Device Manager. It is not recognized as an Arduino, although it will work properly and code from the Arduino IDE can be loaded to it. After installing the Arduino driver that comes with the Arduino software, the Arduino will be shown as an Arduino on a COM port in Device Manager. The difference is shown in the image below.

Windows Default COM Driver and Arduino Driver

Windows Default COM Driver and Arduino Driver

As can be seen in the image, with the default Windows 10 driver installed, the Arduino appears as USB Serial Device (COM4) (left), but after the Arduino driver is installed the same Arduino appears as Arduino Uno (COM4) (right).

Full instructions on installing the Arduino IDE software and updating the Arduino driver can be found in the article on how to install Arduino software and drivers on Windows 10.

Floating Point Numbers don’t Print with sprintf in Atmel Studio AVR C

When writing C program code for 8-bit Atmel AVR microcontrollers and using Atmel Studio, functions such as printf() and sprintf() do not print floating point numbers of type float. Instead of printing a float to a string or standard output, a question mark is printed.

Question Mark is Printed from the sprintf Function Instead of Float Number

The image below shows the output from the serial port of an AVR microcontroller that printed a floating point number to a string using the sprintf() function. The string was then sent to a terminal program running on a PC. The C program was built in Atmel Studio 7 using the default project settings. As can be seen, floating point numbers don’t print with sprintf, but a question mark is printed instead of the expected number.

Floating Point Numbers don't Print with sprintf in Atmel Studio AVR C

Floating Point Numbers don’t Print with sprintf in Atmel Studio AVR C

Cause of the float Printing Problem

The problem occurs because Atmel Studio 7 uses the minimal version of the function that all the printf family of functions rely on. Using the minimal function reduces code size of the printf family of functions which is desirable when using microcontrollers, especially the smaller 8-bit AVR microcontrollers that have small amounts of memory. Floating point numbers are not supported by the minimal function, causing the question mark to be printed instead of the floating point number.

Printing float Numbers with sprintf using AVRs and Atmel Studio

To fix the floating point printing problem, the full function that the printf family uses must be linked into the program instead of the minimal function. The article on how to print floating point numbers in AVR C code with Atmel Studio 7 shows how to include the full function by changing linker settings in Atmel Studio.

After changing setting in Atmel Studio, the sprintf function works properly and prints the floating point number to the terminal as shown in the image below.

Printing float Numbers with an AVR Microcontroller using sprintf

Printing float Numbers with an AVR Microcontroller using sprintf

Arduino Internet Voltage Monitoring

Arduino Internet voltage monitoring can be achieved in several ways. The Arduino can be set up as a client or a server in order to display measured voltage on a web page. In this article an Arduino is set up as web server that hosts a web page stored on SD card. The web page displays the voltage measured on Arduino analog pin A2 in near real-time. The web server also interacts with ThingSpeak, a Internet of Things (IoT) service which logs voltage over time. Voltage is displayed on the hosted web page on a gauge and in a ThingSpeak generated graph or chart.

Arduino Internet Voltage Monitoring

Arduino Internet Voltage Monitoring

How Arduino Internet Voltage Monitoring Works in this Project

The Arduino web server hosts a web page that communicates with the Arduino using JavaScript / Ajax. This allows the voltage to be sent from the Arduino to the web page over the Ethernet connection to update the voltage in the gauge on the web page. A potentiometer is used to vary the voltage on Arduino pin A2 between 0 and 5 volts.

The raw value from the Arduino analog input is sent to the web page and converted to voltage in the JavaScript that runs on the page. The raw analog value is also displayed on the web page and will be between 0 and 1023.

After the voltage is calculated, it is sent to ThingSpeak by JavaScript. ThingSpeak logs the voltage and plots the graph of the voltage. The graph in the above image is created by copying graph code from ThingSpeak which then updates the graph with the data from the ThingSpeak server.

Voltage Update Timing

Voltage is measured by the Arduino and updated on the web page every 200ms. ThingSpeak only updates graph or chart values every 15s (fastest update speed), so the JavaScript code only sends updates to the ThingSpeak server every 20s.

Tutorial for the Project and Other Resources

A full tutorial is available which explains how to set up this project on your own Arduino.

Learn how ThingSpeak works and how to set up a channel to send data from an Arduino to an account on the ThingSpeak server — ThingSpeak is a free service.

Learn about measuring voltage with Arduino.

Arduino Ethernet shield tutorial explains how to set up an Arduino and Ethernet shield as a web server.

 

 

How to Plot Sensor Data to a Graph over the Internet with Arduino

Getting sensor data from an Arduino and sending it over the Internet to display the data in a graph can be a rather challenging task. This task is made extremely easy when using a IoT (Internet of Things) web service instead of setting up the Arduino to host a web page that contains the sensor data graph. Any Arduino board that has Ethernet on it or any Arduino board with an Ethernet shield can be used to make an Arduino Internet graph.

Arduino Internet Graph

An Arduino Internet graph can easily be made by using the ThingSpeak platform to do all the hard work like capturing the sensor data and plotting it to a graph. The image below shows Arduino analog pin A0 voltage plotted on a graph that is displayed in an account on the ThingSpeak website.

Arduino Internet Graph

Arduino Internet Graph

 

 

 

 

 

 

 

 

 

How it Works

A ThingSpeak library is installed in the Arduino IDE using the Arduino library manager. The library provides functions that can be used to communicate with the ThingSpeak web server.

A free account can be opened on the ThingSpeak website which allows channels to be created. Data from the Arduino, which can be sensor data, voltage, or any other data, can then be sent to the channel and plotted on a graph at the website. Each channel can have up to eight fields, enabling data from up to eight sensors to be sent over one channel.

When using ThingSpeak, no SD card is needed and the Arduino and Ethernet shield or other Arduino board that has Internet capabilities is set up as a client rather than a server. No special Internet router settings need to be made when the Arduino is used as an Internet client, making setup and use very easy.

Arduino Internet Graph Plotting Tutorial

A full tutorial on how to plot sensor data over the Internet with Arduino is available in the article Logging Data and Displaying Graphs over the Internet with Arduino.