Arduino parts

Software Tools

Fritzing (for simple wiring)
Draw wiring pictures

 Microcontroller / FPGA

Arduino UNO
The original Arduino
 5 V
Arduino 101
Connect to Bluetooth LE
Includes gyroscope and accelerometer
Based on Intel Curie
Arduino UNO with MIDI mod
Connect to iPad3 using USB-MIDI
5 V
Arduino UNO with 3V3 mod
Connect to LX9 FPGA
3.3 V
ESP8266 Toy
Connect to WiFi
3.3 V, includes regulator + LiPo charger. Wire CH340#14-ESP12#1 and CH340#13-ESP12#12.
ATmega256RFR2 Xplained Pro Evl Kit
Connect to Zigbee
LX9 FPGA Dev Board
 FPGA development
Xilinx Spartan-6 FPGA board
Raspberry Pi 3
 Linux development

Parts, Breakouts and Shields


MEMS Microphone
Digitize audio
3.3 V or 5 V (clean)
200 mV with Vcc/2 bias
Rotary Encoder with knob(s)
Input digital value
Library (or alternative)
uses 6mm D-shaft


3mm LEDs
Indicator light
red 1.8 – 2.2 V; 16 – 18 mA
green 2 – 2.4 V; 16 – 18 mA
yellow 2 – 2.4 V; 16 – 18 mA

Networking and Radio

Arduino Ethernet shield
Ethernet Shield
Connect to Internet

Power Supply



3.3V Regulator (1.2V drop)
Power regulator
3.3V Regulator (0.4V drop)
Power regulator
5V Regulator (0.4V drop)
Power regulator
3.3V Regulator
Power regulator
Non-inverting Buffer & Line Driver Hex
Level shifting
RS-485 Interface 3.3V Transceiver
RS485/UART interface
Power diode
Small signal switching NPN transistor
Small signal switching PNP transistor
own work
3.5 mm pitch terminator
Connect power
Stanley 25-Compartment Organizer
HDMI/DVI interface for Raspberry Pi
Output for Raspberry Pi
Resistor kit
E12 values from 0 – 10 MΩ
1/4 W
Capacitor kit
4.7 pF – 470 μF
50 V
ceramic / aluminum electrolytic

Workbench Tools

Fluke 115 Multimeter
Measure analog signals
Atmel 802.15.4 USB Stick
Zigbee sniffer
Bluetooth sniffer
Atmel ICE Basic
Software Debugging
Quick start
Mini Keyboard
Input for Raspberry Pi

Lego Mindstorms NXT


Notes on using 3.3V and 5V together.

See also Soldering with Kids.

More: Sylvia, What is arduino?, Tutorials (sparkfun), Makezine, Instructables

Pitch Detection on Arduino using Autocorrelation

By our entrepreneur in residence, Johan Vonk

While playing my clarinet, I realized that it would be fun to hear other instruments playing alongside me. Instruments like guitar, piano or even a choir. It would also be nice if the melodies could be transcribed on paper. All existing solutions to these problems require a bulky computer or a cell phone. I realized that creating this compact device would combine my interest for music with my passion for engineering and math.

This project creates a small, affordable and accurate device that listens to a musical instrument and recognizes the notes played. These notes can then be sent to a synthesizer in the common MIDI format. This allows musician to hear other instruments playing alongside with them, and allows them store their compositions.\(\)

The implementation is in C++ and uses an Arduino UNO, breadboard, microphone and optional display. It displays the music as a piano roll and sends it to an external synthesizer.

Those that want to jump straight to the core, read at least the hardware page and download the code through GitHub.


Five years ago, I asked my dad “How do computer do math?”. Ever since, we have spent countless hours learning about the semiconductor physics, diode logic, programmable logic and microprocessors. I find it fascinating to learn about physics and engineering. With the help and dedication of my father, I then started programming. He has provided valuable insights and suggestions allowing me grow. While it can be frustrating at times, I also find it very enlightening to build programs with ever increasing complexity.

For this project, I conducted the research and development at home. As always, my father supervised the project and helped me with architecture and code reviews to keep it readable and maintainable. He also provided suggestions to organize the code to make modules reusable and testable. In particular, he helped me when the software appeared to have random crashes. He explained about heap and stack pointers, and suggested to test for at least a 50 bytes headroom after the data structures.

Goal, design criteria and constraints

The project creates a small embedded monophonic music transcription system. Monophonic means one sound, so you can transcribe one note at a time. Therefore you cannot use this device to analyze what a band is playing without each instrument playing separately.

The device samples an analog audio signal, processes it and creates a digital MIDI output. MIDI is a digital annotation for music that signals the beginning and ending of each note.

I set out to adhere to the following design criteria:

  1. It should detect the correct pitch for notes produced by a B♭ clarinet but also work for other monophonic instruments.
  2. The beginning and duration of each notes should be identified, regardless of it being followed by a rest, note change or note repetition. This process is called segmentation.
  3. There should be no noticeable delay between the incoming audio signal and the digital MIDI output.

The cost of the initial prototype, excluding the optional display, should be under $20 and fit on a credit card size PCB. To address these constraints, I chose to build the device around the commonly available Arduino UNO, an open source prototyping platform based on an 8-bit 16 MHz microcontroller with only 2 Kbyte SRAM. Using such a slow microcontroller with limited memory posed interesting challenges but also keeps the cost down. By creating a custom PCB, the final product can be approximately 1 inch in diameter what allows it to be clipped onto an instrument.


The common method of detecting a note pitch is by using a fast Fourier transform (FFT). This project shows that similar results can be achieved using autocorrelation. This method has the advantage of requiring only half the amount of memory compared to a FFT. The algorithm incorporates optimizations such using a low sample rate, simplifying the autocorrelation formula, using interpolation and asynchronously sampling the audio signal.
Testing with public audio samples, I found that all clarinet notes from 155.6 Hz (Eb3) to 1568 Hz (G6) are recognized correctly. Using normalization, this range can be extended to 98 Hz (G2) to 1568 Hz (G6) for the wider range of the piano. This small device enhances the experience of playing an instrument.
The source code is shared through GitHub what allows others to learn and improve this product.
Following chapters describe my project in detail. From the hardware schematic to verification methods. I hope you enjoy learning from my experience.

Table of contents

  1. Hardware
  2. Signal path
  3. Toolchain
  4. Digitizing the analog signal
  5. Frequency and pitch detection
  6. Note level segmentation and buffering
  7. Visualizing the notes
  8. Sending MIDI events
  9. Verification
  10. Conclusion

Web browser accessing Arduino data

This article shows how an external web site can change i/o values on your Arduino. All you need is a RGB LED and an Arduino with an Ethershield or the newer Arduino Ethernet. (The other choice was a module around the Microchip ENC28J60. This has a lower price, but relies of the Arduino for the TCP/IP stack.)

To develop the web page, we use that enables rapid prototyping and testing. The web page consists of HTML, JavaScript and a style sheet. The JavaScript code handles the communication with the Arduino. No need to embedding web pages in your sketches, or shuffling an µSD card back and forth each time you want to try something new.


In this example we use a web interface to control a RGB LED on the Arduino. The web interface has a slider for each primary color. When a slider is changed, the new value is sent to the Arduino. The sketch on the Arduino then adjust the intensity of that color.

User Interface

jQueryMobile lets you build a sleek user interface with minimum effort. The complete HTML code for the page that we will be using is shown below. Note that when using jsFiddle, you only need the element It will add the based the libraries that you select. For the complete page with the CSS and JavaScript, please refer to the web page code further down.

<!DOCTYPE html>
<html class="ui-mobile">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <base href=".">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Web browser accessing Arduino data">
    <script src=""></script>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <div data-role="page" id="pageone" data-theme="b">
      <div data-role="content">
	<div id="slider-r-div">
	  <label for="slider-r" class="ui-hidden-accessible">Red:</label>
	  <input id="slider-r" type="range" name="r" value="0" min="0" max="255" data-highlight="true" data-role="slider"></input>
	<div id="slider-g-div">
	  <label for="slider-g" class="ui-hidden-accessible">Green:</label>
	  <input id="slider-g" type="range" name="g" value="0" min="0" max="255" data-highlight="true" data-role="slider"></input>
	<div id="slider-b-div">
	  <label for="slider-b" class="ui-hidden-accessible">Blue:</label>
	  <input id="slider-b" type="range" name="b" value="0" min="0" max="255" data-highlight="true" data-role="slider"></input>


“A life without challenge, a life without hardship, a life without purpose, seems pale and pointless. With challenge come perseverance and gumption. With hardship come resilience and resolve. With purpose come strength and understanding.” ― Terry Fallis, The High Road

While writing the code, I encountered and tackled a few unexpected things. First, the Arduino Ethernet library could not support multiple clients to the same server port. Second, the Ethernet controller didn’t come up reliably. Last, the same-origin policy, intended to protect web surfers, required a work around. Let’s look at these issues one by one.

Multiple clients

We like to support up to four simultaneous browser sessions that communicate with the Arduino. Two support this, we need address two things. First, the Arduino Ethernet library needs to be patched to allow multiple clients to the same server port. A detailed description can be found here. Second, the browser needs to periodically read the color values from the Arduino, in case another browser session changed them. This is done by calling setInterval(scheduduledUpdate, 1000) from JavaScript.

Ethernet controller timing

After searching the internet and finally reading the datasheet, I realized that the Wiznet based Ethernet Controller takes longer than the Arduino to come out of reset. I later found a good write up at freetronics. It comes down to that the Ethernet Controller needs an additional 50 milliseconds before it is ready to communicate with the Arduino.

Same-origin policy (JSON-P)

As a JavaScript developer, you probably used asynchronous JavaScript and XML (Ajax) to exchange data with a server or update a web page. While sending an Ajax request to a server in the same domain is fairly straight forward, exchanging data with a server on different domain is a different story. The same-origin policy restricts scripts running in a browser to pages in the same domain. With your web site on and your Arduino on your local LAN, we need to work around this policy. We exploit the fact that <script> tags are not subjected to the same-origin policy. This is the same method that allows you to include the jQueryMobile library even it it is hosted on Google’s content delivery network.

JSONP requests are made by dynamically requesting a <script> tag from the Arduino. The Arduino responds with JSON wrapped in a function call. When making the request, the function name is specified as a callback function. When the server responds, the callback function (which must exist on your page) is executed with the JSON data as parameters. JSON is a human-readable format consisting of attribute-value pairs

For example, the browser evaluates the code. It replaces the missing callback name (?) with a unique name for the anonymous function, and adds an unique _= parameter to prevent caching by the browser.

$.getJSON("" + "?callback=?", { r: 12 }, function (jsonData) {

The browser will treat this as the HTML code shown below, and sent it over HTTP to the Arduino.

<script src=""></script>

The Arduino receives this as

GET /json?r=12&callback=jQuery210015603271196596324_1431060286376_=143106

and replies with the current values for red, green and blue

jQuery210015603271196596324_143106028637({ r: 12, g: 20, b: 20 })

The browser then executes this JavaScript.

(jsonData={"r": "12", "g": "20", "b": "20" }) {console.log(jsonData);}

That concludes the exchange.

The code

Now where we have all been waiting for. As mentioned earlier, the web page is hosted on jsfiddle. The sketch should be placed on the Arduino. I tested the sketch with the UNO R3 and version 1.6.3 of the IDE. Other versions may require some adjustments.

Bread board

Use a common cathode RGB LED, or just three separate LEDs. On the Arduino, digital outputs 5, 6 and 9 are each connected through a 220Ω current limiting resistor to the corresponding LED anodes. The cathode is, as you might guess, connected to ground. (note to self: use KiCAD and embed using CircuitBee.)

RGB-LED_schem RGB-LED_bb

Web page

jsFiddle to develop the HTML, JavaScript and CSS code for the web page. For development, I use the external resource firebug-lite-debug.js that among many other things shows the debug output (console log).

The web page presents three sliders. The fiddle is embedded below. Click on the Edit on the top right to make changes. Resize the top of the result tab to see the sliders.

Arduino Sketch

The sketch is not very earth shaking. It gets an DHCP assigned IP address. Make sure that you change the MAC address in the sketch listed below. You should use the MAC that was assigned to your shield. If you don’t have that, at least make sure that the number unique on your network.

The sketch listens on port 80. It parses the HTTP command into the command itself (GET), the URL and the parameters. One of the parameters is the name of the callback function as explained when we discussed the JSON-P protocol. Other parameters may be ‘r’ for red, ‘g’ for green and ‘b’ for blue. When found, their value is stored in the sketch, and used to adjust the intensity of that primary color At the end it sends a JSON-P response. The code is at GitHub.

Have fun! You can leave comments below.

Copyright © 2018 Coert Vonk, All Rights Reserved