Software | Arduino

Quick navigation:

General information: Arduino Uno Jump to top of page



General information: Arduino and Electronics Guidebooks, Component Datasheets Jump to top of page

Tools: Fritzing Jump to top of page

Custom Libraries: Siemens DL1414T Jump to top of page

The DL1414T is a .112" red, 4-character 16 segment plus decimal alphanumeric intelligent display with memory/decoder/driver.

Its Arduino Uno implementation uses 7 data input pins (0 to 6), 2 pins for digit selection (7 and 8) and 1 pin for writing (9). The library provides functions for setting individual digits (both as complete characters, or their individual bits), showing a string, integer, and float, as well as ticker-taping a longer string.

  • Class methods:
    • void setDigitRaw(int digit, boolean bit6, boolean bit5, boolean bit4, boolean bit3, boolean bit2, boolean bit1, boolean bit0);
    • void setDigit(int digit, char character);
    • void clearDigits();
    • void showStr4(char c3, char c2, char c1, char c0);
    • void showStr4(String s);
    • void showInt(int i);
    • void showFloat(float f);
    • void ticker(String s);

Custom Libraries: Button Debouncer Jump to top of page

The ButtonDebouncer class provides an easy way to check the status of a series of push buttons. It allows for monitoring of debounced presses, as well as distinguishing between short and long(er) presses.

Custom Libraries: Simple Tune Player Jump to top of page

The SimpleTunePlayer class provides an implementation to play a sequence of notes via a small speaker.

Custom Libraries: Linked List Jump to top of page

The LinkedList class provides an implementation of a linked list.

Projects: Resistor Man Jump to top of page

Projects: MOSFETs Jump to top of page

MOSFETs are metal-oxide-semiconductor field-effect transistors used for amplifying or switching electronic signals. The following two photographs show examples of a MOSFET connected to the Arduino Uno R3. Each time a pushbutton drives a yellow LED. In the first case we use a simple setup, whereas in the second one we use a more complex setup involving a capacitor.

Projects: Arduino in Action: Reactometer Jump to top of page

The ReactoMeter measures your reaction time. When activated, the red LED initially shines. Once it goes out and the green LED turns on (start indicator), press the push button as fast as possible. In between, the yellow LED sequence lights up. Your reaction time is measured and reported via the serial connection.

Arduino sketch

Projects: Potentio Meter Jump to top of page

The potentio meter controls two actuators: the red-yellow-green LEDs, as well as the pitch of the speaker. The LEDs are grouped per thirds of the potentio meter's full range.

Arduino sketch

Projects: LED Cycler Jump to top of page

The LED cycler traces a sequence of two adjacent LEDs from left to right and back, like a Cylon's eye. If the push button is pressed, the cycler changes its operational mode and mimicks a voice VU meter, randomly expanding LEDs from the centre on. The potentio meter controls the speed of cycling for both operational modes.

Arduino sketch

Demonstration (AVI, 35.09 MiB)

Projects: Light-Controlled Theremin Jump to top of page

When activated, the yellow LED is turned on for 5 seconds, during which you should move your hand back and forth over the light-dependent resistor (LDR). When the yellow LED goes out, the pitch of the speaker is controlled by the amount of light received by the LDR.

Arduino sketch

Demonstration (MP4, 32.27 MiB)

Projects: Morse Code Generator Jump to top of page

When activated, you can type a message in the computer's serial monitor. This message is then sent to the Arduino, which converts it into Morse code. The corresponding pulses are then shown by the blinking yellow LED, as well as a tone emanating from the speaker. The small potentio meter controls the pitch of the tone. Using the push button, a user can manually pulse the Arduino.

Arduino sketch

Demonstration (MP4, 14.8 MiB)

Electrical diagram:

Assembled and soldered protoshield:

Projects: Temperature and Light Logger Jump to top of page

The temperature and light (TaL) logger shield requires stacking it on top of an Adafruit Assembled Data Logging shield for Arduino. It can be used in combination with a suitable standalone battery pack that is connected to the top of the TaL shield via the white connector. Once activated or reset (via the top-left button), the red LED is turned on indicating that the TaL logger is inactive. At this point, the logger can be calibrated by looking at the measured temperatures that are being sent to the serial monitor. To that end, the small potentiometer provides a -5 to +5 °C additive offset to correct the measurements. The centred button switches the logger from inactive to preparation mode, at which point the yellow LED starts blinking for 5 seconds. During this time, no measurements are stored and the unit can be put in its place. Once the preparation time has elapsed, all LEDs go out and the TaL logger starts recording the current date and time, temperature, light level, and internal voltage every second,storing them to the SD-card in successively differently- named files. Note that in case an error during initialisation of or writing to the SD-card occurs, the red and yellow LEDs starts flashing alternatingly. Pressing the centre button again stops the measurements and returns the unit to the inactive state.

Arduino sketch

Processing sketch

MATLAB script

Electrical diagram:

Assembled and soldered protoshield:

Projects: 3x3x3 LED Cube Jump to top of page

This 3x3x3 LED cube consists of 27 LEDs, of which 14 are red and 13 are green, all positioned at alternating positions such that every red one is surrounded by green ones and vice versa.

The cube consists of three planes, each one containing nine LEDs. For these LEDs, all the cathodes are soldered together, so we have a common cathode per plane. All three planes are then stacked on top of each other, whereby we solder the anodes per column together. There is a 150 ohm resistor put in series with each of the nine columns to limit the current on the anodes. They are then connected to nine output pins on the Arduino.

Furthermore, we use three BC547B NPN transistors with their bases put in serial with three 22K resistors to control the cathodes. Each plane's cathode is then connected to a transistor's collector; all the emitters are connected to ground. The bases are connected to three output pins on the Arduino.

In order to turn on a single LED, we select the correct pin in the XY plane, and the pin for the respective Z plane. This technique has one side effect though: if we light a LED in one layer, and another one from another column in another layer, then all LEDs in both columns and planes are lit. To tackle this, we use persistence of vision (POV), whereby we only light one plane at a time, but very rapidly cycle between successive planes. If we do this fast enough (on the order of milliseconds), then we create the illusion of a single image.

Arduino sketch

LinkedList library

Demonstration (mp4, 36.2 MiB)

Electrical diagram:

Assembled and soldered perfboard:

Projects: Binary Clock Jump to top of page

This clock shows the current time in binary. To that end, it gives separate indications for the current second, minute, and hour. These are each second updated and shown as a sum of powers of two. Because there are in total 6 + 6 + 5 = 17 LEDs to be controlled, we use a 74HC595 parallel shift register to have extra controls. The code running on the Arduino gets the current time from a connected DS1307 real-time clock (RTC). There is also a pushbutton connected to the system, allowing for switching between whether or not to show the running seconds. Pushing the button for a longer period of time allows to toggle all the LEDs on the display on or off. Pressing it longer switches the clock between showing the time or giving a small lightshow. Pushing the button even longer, puts the Arduino into sleep mode.

The code running on the Arduino continuously checks the button's status. Depending on this, it will take different actions. One of them is the updating of the LEDs to reflect the time obtained from the DS1307 RTC. In case the lightshow is active, the code shows various effects in succession. Because of the limited amount of SRAM memory on the Arduino, each effect is loaded into memory as a sequence of steps, and deleted when the effect has played. During each cycle of the loop() function, the code keeps track of the current effect and the current step within the effect. When an effect has been played fully, the code automatically moves to the next one.

Arduino sketch

LinkedList library

ButtonDebouncer library

Demonstration of clock (mp4, 16.88 MiB)

Demonstration of lightshow (mp4, 20.58 MiB)

Electrical diagram:

Assembled and soldered protoshield:

Projects: Simon Says Game Jump to top of page

This is the Arduino version of the classic 'Simon Says' game, whereby the game is to repeat the sequence of colours/tones that are shown/played by the controller. Each time the game starts, the user pushes one of the buttons corresponding to each colour to select one of four difficulty levels to play. These range from white (easy) over green (medium) to yellow (hard) and red (very hard). Pushing a button longer resets the highscore for that level. Once a level is selected, the controller plays a random sequence, each time increasing in length. The user remembers the sequence and pushes the corresponding buttons. The game continues as long as the user enters a correct sequence. When the wrong button is pressed, the game ends. A winning tone is played when the highscore for that level is broken, a losing tone otherwise. In case a serial output monitor is connected, the menu and results are also shown. The electrical circuit uses three 150 ohm resistors for the green, yellow, and red LEDs, one 2K2 ohm resistor for the white LED, and four 10K ohm resistors for the push buttons. There is another 2K2 ohm resistor for the speaker to attenuates its loudness more. To play music, we use the SimpleTunePlayer library. The highscores are stored in the Arduino's EEPROM memory, so that they are remembered after powering off.

Arduino sketch

ButtonDebouncer library

SimpleTunePlayer library

Demonstration of game (mp4, 73.7 MiB)

Electrical diagram:

Assembled and soldered protoshield: