Experimenting with Microcontrollers – an Arduino development kit for under £10

Spread the love

For under £10, you can put together a microcontroller development platform, ready to program directly from your PC over USB using free Arduino software. Once programmed, your microcontroller will run autonomously, untethered from your PC, powered by as small a battery power supply as a single 1.5V AAA or 3V CR2032 coin cell. You can have it interact with its environment using dozens of low-cost sensors and motors. Everything you need to explore the exciting world of embedded systems is available to you, typically for less than a day pass on the London underground.

An Arduino Nano microcontroller development kit for under £13

A homebrew Arduino Nano microcontroller development kit for under £12 (including optional OLED display)


What do you need to get started with microcontrollers? Apart from a PC and the willingness to experiment (Google is your friend!), below is a list that gives you an inexpensive, minimal development kit for under £10. Everything is available on Amazon (prices are as of April 2019). Tools e.g. multimeter, mini pliers, wire strippers, soldering iron, can be found inexpensively from the equipment list..

Parts List for a low-cost Arduino Nano development kit

  1. Arduino Nano microcontroller v3.0, with 30 dual inline pins for inserting directly into a solderless breadboard. £2.33 ea.
  2. Solderless breadboard 400 tie-points, large enough to accommodate the Nano microcontroller, and additional components. £1.31.
  3. Portable power using 1.5V AAA battery (30p) with LilyPad 5VDC Boost Converter (has convenient on/off switch). LilyPad £1.87.
  4. Half dozen small LEDs (3mm) and resistors (1K ohms is fine) – less than 10p
  5. Buzzer – with 2-pins, this is a simple component that can give a diagnostic beep, or a pitched tone driven by the Nano using tone() command. 34p ea. (A speaker will require amplification of some kind, and while a simple 2N2222 transistor can work, it’s a bit more hassle and not essential)
  6. Small jumper wires (10cm male-male), 40 pc. £1.44
  7. USB mini cable for programming Nano directly from PC. £1.48.
  8. Arduino software IDE (FREE!) for programming the Nano using the C language (Tip: get the zip download for portable installation)

Total: £8.87

Optional (fun, but not required, as text-based debugging is not really the way to go in embedded development — easier and much more memory efficient to use LEDs and or tones)

  • OLED display 4-pins, 128×64 pixels, giving 8 rows for text or graphics, communicates using I2C (2-wires), open-source software driver available for the Nano. £2.13.

What can you do with this setup?

Once you have this built, it is straight-forward to explore the capabilities of the versatile ATmega 328P AVR 8-bit microcontroller. Note this is the same microcontroller as in the Arduino Uno, so libraries for the UNO will work with the Nano (with minor adjustments for pins and capabilities).

Example projects in order of simplicity:

(1) Light Stage Earlier this year, my daughter Jasmine (7yrs) and I designed and built this LED Light Stage together. She built the amphitheatre out of newspaper and some scrap wood, and wired the LEDs around around the stage, I programmed the Nano to flash the lights to create a Glastonbury music festival effect. Notice her Lego Friends dotted about the stage 🙂

Glastonbury Music Festival set for Lego Friends

Light Stage built using various colored LEDs powered by a 6V battery (2x CR2032 coin cells) and an Arduino Nano to custom flash twelve yellow and red LEDs for a dynamic live rock concert effect.

Light Stage built using various colored LEDs powered by a 6V battery (2x CR2032 coin cells) and an Arduino Nano to custom flash twelve yellow and red LEDs for a dynamic live rock concert effect.

Arduino Nano powered by 1.5V AAA with 5V boost converter, controlling twelve LEDs independently.

Arduino Nano powered by 1.5V AAA with 5V boost converter, controlling twelve LEDs independently.

(2) Music Box w/ Light Display We then used the same Nano setup to create a light & sound module that plays four songs in a looped sequence through a tiny PC speaker, while flashing a series of 12 yellow & red leds. Jasmine used this to add music-box style sound to her toy ice-cream van. The songs are programmable note by note, using the Nano command tone(pin, Hz, duration), and a music frequency lookup chart (e.g, middle C is 261.63Hz, and A in the same octave is 440Hz, see below).

Musical Notes and Associated Frequencies

Musical notes & associated frequencies (Hz). (Mathematical aside: Note that the modern Western musical scale is multiplicative — there are 12 semitones in an octave, and each octave is double the frequency of the one below. Based on this, the frequency ratio between successive semitone is 12th-root of 2 = 2^(1/12) = 1.05946309436, or a FIXED ~6% increase in frequency from note to note. This is the equitempered system popularized by Bach in the 18th century.)

(3) Digital Voltmeter It’s not hard to build your own digital voltmeter, with 0-5V range, using the Nano’s 10-bit analog-to-digital (A/D) converter. Connect one jumper cable to ground, and the other to the analog pin you’re reading from, and you now have voltmeter probes. The A/D chip will output a reading from 0 to 1023 counts, with each count 4.89mV (= 5V/1023). To see the values, read the pin using the Arduino instruction analogRead(pin) and write out the result to a small external OLED display. (The OLED Display is controlled by a SSD1306 display chip with Arduino device driver ssd1306_i2c.ino from Adafruit that comes standard with the Arduino IDE. OLED tutorial.

Digital Voltmeter, 0-5V range, 4.89mV resolution, AAA powered, using Arduino Nano and OLED display

Digital Voltmeter, 0-5V range, 4.89mV resolution, AAA powered, using Arduino Nano and OLED display

(4) Traffic light controller for 4-way intersection Using low-cost LED traffic light modules (£0.79 ea.), I was able to put together in about 60 minutes a timed traffic light demonstration. Total cost £7.40 = £3.16 for 4x traffic light LED modules, £2.50 Arduino Nano microcontroller with mini-USB programming cable, £1.65 for AAA 1.5V to 5V boost converter power supply, 10p AAA battery. On top, £5.30 in solderless breadboards for easy wiring (4xZY55-, 1×170- tie points) and a ZY-001 baseboard for mounting the ZY breadboards). The C code for running this is less than 50 lines (see Appendix 5). Note, if your traffic light modules have a rather dim green LED, there is an easy workaround covered in Appendix 4. Also Next step will be integrating sensors to detect the approach of toy cars, using either low-cost short-range RFID tags, or 4x vibration sensors on the approaching roadways.

Traffic controller for 4-way intersection using Arduino Nano microcontroller in 50 lines of C code (timed rotation only, no sensors)

Traffic controller for 4-way intersection using Arduino Nano microcontroller in 50 lines of C code (timed rotation only, no sensors)

(5) Long-Range RFID Sensor & Alarm I also built a long-range boundary sensor using the Nano as the core microcontroller interfaced with an RFID tag reader board and a high-gain RFID antenna capable of creating an 8-foot perimeter. The microcontroller is interfaced with a flashing strobe and 100dB siren to alert when an RFID tag crosses into detection range (see below).

RFID Perimeter Sensor with Arduino Nano as core microcontroller
Prototype version 0.1: board mounted (literally on a piece of pine!) stored in Pelican case.

RFID Perimeter Sensor, prototype v0.1

RFID Perimeter Sensor, prototype v0.1

Prototype version 0.2: Pelican case mounted, with all components drilled and screwed into the case, and connectors panel mounted.

RFID perimeter sensor v0.2, case mounted.

RFID perimeter sensor v0.2, case mounted.

The possibilities are endless To build your own creations, you can choose from dozens of low-cost sensors and motors compatible with the Arduino, including: infra-red detectors, magnetic reed switches, DC motors, motion detectors, ultrasound ranging, ethernet, 2.4G wireless, RFID, knock sensors, temperature, soil humidity/moisture, photo-interruptor, photoresistor (light detection), relays (for power control), tilt switch, dual axis joystick, flame sensor, sound detection, microphone, smoke, alcohol, methane, color, keypad, bluetooth, barometric pressure, OLED display, GPS, gyroscope/accelerometer, inertial measure unit (IMU), and computer-to-computer communications via high-speed serial TTL.

Plug & Play Sensor modules, from $0.50 to $2.00 each. Shown: flame detector (light spectrum), sound detector (microphone), magnetic reed switch, Hall effect sensor, metal touch sensor, and thermistor (human touch)

Plug & Play Sensor modules, from $0.50 to $2.00 each. Shown: flame detector (light spectrum), sound detector (microphone), magnetic reed switch, Hall effect sensor, metal touch sensor, and thermistor (human touch)

What you create is limited only by your own imagination. Happy creating!


Pushing the Boat Out with the ATTINY microcontrollers – Super Low-Power, Low-Cost, Small Size

(April 30th, 2021)

Two years ago I wrote the above, and it is still valid (though electronic component sellers seem to have have increased prices 1.5-3x since then, ostensibly due to the COVID pandemic/semiconductor crisis). You can still find most of the components to keep the cost below £12.

Since then, I’ve added a few nifty techniques to enable rapid prototyping with Atmel microcontrollers.

The first is a 3-instruction Forth platform written for the Atmel328P processor (Nano, Uno, etc.) and communicating over a serial link with the host computer, typically your laptop (you currently need RealTerm free software to open the connection, after which you can drop into GForth).

The key value that this software brings is that you can work directly with the microcontroller in an interactive, dynamic Forth environment (I use GForth on Windows). Using this it’s taken me as little as 30 minutes to wire up and test the functionality of a new sensor or component, without the trial and error programming that Arduino’s native C-code forces upon you.

Once you’re happy with your application and have worked through all the quirks and bugs in your design, then it’s usually a straightforward matter to create an untethered application. You simply translate what worked from Forth back into C code and compile the driver logic directly into the Nano.

But then what’s really cool is that you can use the same Arduino/Forth development chain and drop from the Nano to the ATTiny85 (DIP-8, 5 I/O pins) or ATTiny84 (DIP-14, 11 I/O pins) microcontroller. This really shrinks things down and delivers lower power, lower cost, and significantly smaller sized little things. For starters, the ATTiny85 is DIP-8, the Nano is DIP-30. The ATTiny85 sips on avg 3mA power in a benchmark use vs. 20mA power for the Nano. The really fun part? As long as none of the rest of your components require 5VDC (especially watch out for ICs), you can get away with the need for a DC boost converter and simply power your whole device with 3V (could be a 3V coin cell, a 3V LiIon battery, or 2x any 1.5V battery whether button cell, AAA, or AA, C or D batteries)! With a bit of soldering and some small prototype PCB you can make some nifty little gadgets.

Knight Rider LED device powered by ATtiny85 controlling shift out register IC 74595 all powered by 3V button cell battery

Code that works on the Nano typically needs only a new pin assignment to Atiny using preprocessing conditionals #ifdef TINY85 … #endif and #ifdef NANO … #endif to keep a single code base. For an example with details on how to do this, including code for dropping from Nano into ATTiny, and what you need to do to compile for the Tiny uCs, see my article on Making Sensors Talk for Under £5.

Bringing Junk Model Robots to life with Talking Motion Sensors (April Fools Prank, 2021)

Enjoy!

Further Reading

Medly of electronics projects built from Nov 2018 - April 2019.

Medly of electronics projects built from Nov 2018 – April 2019.

 

  • For an exhaustive supply list of electronics components, supplies, equipment, microcontrollers, sensors & motors.

 


Appendices

Appendix 0: Comparison Table for Recommended Microcontrollers

Microcontroller Comparison table: Arduino Nano, Attiny, ESP, etc.


Appendix 1A. Pinout of Arduino Nano v3

Arduino Nano pinout

Arduino Nano pinout

Appendix 1B. Pin Specification and User Guide for Arduino Nano (Components 101.com)

Appendix 2. Pinout of ATtiny85/84

Wiring the Tiny84 to program it using Sparkfun’s Tiny AVR programmer (intended for Tiny85).

Appendix 3. Arduino C cheat sheet
PDF1

PDF2

Appendix 4. Traffic light module – Hack to increase green LED brightness
The LEDs may be nice and big (10mm?) in your traffic light module. If the green LED on yours is much dimmer than the others and not easily seen, try the following workaround: solder a 33R resistor across the terminals of the surface-mounted 330R resistor, creating a parallel connection through the LED with higher voltage. The original low brightness is due to the designer applying the same surface-mounted 330R current-limiting resistor to each LED, instead of using a lower value for green.

To increase the brightness of the Green LED, solder a 33-ohm resistor across the surface-mount 330R resistor to create a lower-resistance, higher-voltage/current parallel path.

Appendix 5. Traffic controller software


/* This program uses the Arduino Nano low cost development board to control a Traffic Light module (R/Y/G LEDs)
Note: Took 60 minutes from concept to completion.
*/

/* 2019-09-29---Sun---12:07
Assad Ebrahim
Board: Arduino Nano
Processor: Atmega 328P
Port: COM5
Programmer: USBtinyISP (not applicable / relevant)
*/

// requires 6 pins
#define NS_RED 5 // north-south lights
#define NS_YELLOW 6
#define NS_GREEN 7
#define EW_RED 2 // east-west lights
#define EW_YELLOW 3
#define EW_GREEN 4
// constants (not pins)
#define EW 0
#define NS 1

void setup() {
pinMode(NS_RED, OUTPUT);
pinMode(EW_RED, OUTPUT);
pinMode(NS_YELLOW, OUTPUT);
pinMode(EW_YELLOW, OUTPUT);
pinMode(NS_GREEN, OUTPUT);
pinMode(EW_GREEN, OUTPUT);
delay(500); // pin settle time
//starting configuration - starts with NS lights red, EW lights green
digitalWrite(NS_RED, HIGH); digitalWrite(EW_RED, LOW);
digitalWrite(NS_GREEN, LOW); digitalWrite(EW_GREEN, HIGH);
digitalWrite(NS_YELLOW, LOW);
digitalWrite(EW_YELLOW, LOW);
delay(4000);
}

void loop()
{ // Design:
// Both stopping & starting go through Amber, but starting goes from red to red/amber before green, while stopping goes G->A->R.
// Timings staggered so law-breaking red light runners pass before crossing lane's startup sequence.
stop_intersection(EW);
start_intersection(NS);
stop_intersection(NS);
start_intersection(EW);
return;
}

// Functions
void stop_intersection(int inters)
{
digitalWrite(inters==EW?EW_YELLOW:NS_YELLOW, HIGH); digitalWrite(inters==EW?EW_GREEN:NS_GREEN, LOW);
delay(1000);
digitalWrite(inters==EW?EW_RED:NS_RED, HIGH); digitalWrite(inters==EW?EW_YELLOW:NS_YELLOW, LOW);
delay(500);
return;
}

void start_intersection(int inters)
{
// start NS
digitalWrite(inters==NS?NS_YELLOW:EW_YELLOW, HIGH);
delay(1000);
digitalWrite(inters==NS?NS_GREEN:EW_GREEN, HIGH); digitalWrite(inters==NS?NS_YELLOW:EW_YELLOW, LOW); digitalWrite(inters==NS?NS_RED:EW_RED,LOW);
delay(4000);
}

2 comments to Experimenting with Microcontrollers – an Arduino development kit for under £10

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

Your comments are valued! (Please indulge the gatekeeping question as spam-bots cannot (yet) do simple arithmetic...) - required

Optionally add an image (JPEG only)

 

Stats: 1,066,417 article views since 2010 (March update)

Dear Readers:

Welcome to the conversation!  We publish long-form pieces as well as a curated collection of spotlighted articles covering a broader range of topics.   Notifications for new long-form articles are through the feeds (you can join below).  We love hearing from you.  Feel free to leave your thoughts in comments, or use the contact information to reach us!

Reading List…

Looking for the best long-form articles on this site? Below is a curated list by the main topics covered.

Mathematics-History & Philosophy

  1. What is Mathematics?
  2. Prehistoric Origins of Mathematics
  3. The Mathematics of Uruk & Susa (3500-3000 BCE)
  4. How Algebra Became Abstract: George Peacock & the Birth of Modern Algebra (England, 1830)
  5. The Rise of Mathematical Logic: from Laws of Thoughts to Foundations for Mathematics
  6. Mathematical Finance and The Rise of the Modern Financial Marketplace
  7. A Course in the Philosophy and Foundations of Mathematics
  8. The Development of Mathematics
  9. Catalysts in the Development of Mathematics
  10. Characteristics of Modern Mathematics

Electronic & Software Engineering

  1. Electronics in the Junior School - Gateway to Technology
  2. Coding for Pre-Schoolers - A Turtle Logo in Forth
  3. Experimenting with Microcontrollers - an Arduino development kit for under £12
  4. Making Sensors Talk for under £5, and Voice Controlled Hardware
  5. Computer Programming: A brief survey from the 1940s to the present
  6. Forth, Lisp, & Ruby: languages that make it easy to write your own domain specific language (DSL)
  7. Programming Microcontrollers: Low Power, Small Footprints & Fast Prototypes
  8. Building a 13-key pure analog electronic piano.
  9. TinyPhoto: Embedded Graphics and Low-Fat Computing
  10. Computing / Software Toolkits
  11. Assembly Language programming (Part 1 | Part 2 | Part 3)
  12. Bare Bones Programming: The C Language

Pure & Applied Mathematics

  1. Fuzzy Classifiers & Quantile Statistics Techniques in Continuous Data Monitoring
  2. LOGIC in a Nutshell: Theory & Applications (including a FORTH simulator and digital circuit design)
  3. Finite Summation of Integer Powers: (Part 1 | Part 2 | Part 3)
  4. The Mathematics of Duelling
  5. A Radar Tracking Approach to Data Mining
  6. Analysis of Visitor Statistics: Data Mining in-the-Small
  7. Why Zero Raised to the Zero Power IS One

Technology: Sensors & Intelligent Systems

  1. Knowledge Engineering & the Emerging Technologies of the Next Decade
  2. Sensors and Systems
  3. Unmanned Autonomous Systems & Networks of Sensors
  4. The Advance of Marine Micro-ROVs

Math Education

  1. Teaching Enriched Mathematics, Part 1
  2. Teaching Enriched Mathematics, Part 2: Levelling Student Success Factors
  3. A Course in the Philosophy and Foundations of Mathematics
  4. Logic, Proof, and Professional Communication: five reflections
  5. Good mathematical technique and the case for mathematical insight

Explore…

Timeline