Crash course on micros: part 1


Click for: part 1, part 2, part 3, part 4, part 5, part 6, part 7, part 8, part 9


This course will take you from a standing start to writing programs for microcontrollers.

This is not a course in electronics, the aim is to get you doing things with microcontrollers. You can find out more about electronics later if you wish and there are plenty of on-line resources to choose from


Contents

  • Part 1: basic kit, tools, components, recommendations, budget, sources, soldering.
  • Part 2: what is a microcontroller, pinouts, clocks, input/output, Pro Mini.
  • Part 3: bits, nibbles, bytes, hex, numbers, characters, ASCII.
  • Part 4: memory, ports, Arduino IDE, breadboards, code, compiling, uploading, flashing LED.
  • Part 5: programming, routines, variables, if statement, serial monitor.
  • Part 6: sounds, loops, arrays, motors, libraries.
  • Part 7: character displays, pixel displays, interfaces, keypads, analog.
  • Part 8: power, resistors, debugging, glossary of TLAs.
  • Part 9: ports, binary logic, bit twiddling, turning a project into a product.

Basic kit

Click on the "Search ebay" or "Search Alixpress" links to get an idea of availability and cost.

Tools

Digital soldering iron (60W)

Soldering is not difficult and is required when adding "headers" to components and when joining wires together.

Search ebay or Search AliExpress

Soldering wire

60/40 (tin/lead) 0.7mm diameter - buy 100g or 250g.
 
 

Search ebay or Search AliExpress

Desoldering pump/sucker

This sucks up solder when desoldering. Get one with a heat resistant flexible spout like the Abeco Flexivac 2008.

Search RS-Online

Side cutter set

Includes cutter for wire, combination pliers and long nose pliers.
 

Search ebay or Search AliExpress

Helping hands

Very useful to hold things like wires when soldering.
 

Search ebay or Search AliExpress

Suction vice

Very useful to hold things when soldering. Particulary useful to hold mini breadboards.

Search ebay or Search AliExpress

Tweezer set

Very useful for picking up small things!

Search ebay or Search AliExpress

 

Multimeter

Essential for measuring voltages etc. No need to buy an expensive one.

Search ebay or Search AliExpress

Components

The search function on the Flux Workshop web site is a good place to start if you want quick delivery in the UK.

Arduino UNO R3

Original Arduino board connects directly to USB. Powered by USB or external power supply.

Search ebay or Search AliExpress

Arduino Pro Mini

Low cost for breadboard use. Requires soldering and a USB-serial adapter. 5V ATmega328 version.

Search ebay or Search AliExpress

USB-serial adapter

Converts USB signals to serial signals to connect Pro Mini to a USB port.
 

Search ebay or Search AliExpress

Breadboards

A simple way to connect components for prototyping. Small (170 sockets), medium (400 sockets) and large (830 sockets).

Search ebay or Search AliExpress

Breadboard U shaped jumper kit

Fairly stiff wire which lies flat to link pins on breadboards. Kits contains varying lengths.
 

Search ebay or Search AliExpress

DuPont jumper wire

Flexible wire to link pins on breadboards. 10cm/20cm lengths. Male to male, male to female and female to female.

Search ebay or Search AliExpress

4 digit 7 segment display

This display is extremely easy to link to the Pro Mini - only two data lines required.

Search ebay or Search AliExpress

Resistor selection pack

Occasionally you will need a resistor and a selection pack contains all the most common preferred values.

Search ebay or Search AliExpress

Assorted LEDs 5V

5V LEDs suitable for breadboard use.
 

Search ebay or Search AliExpress

Momentary tactile switches

6mm x 6mm switches suitable for breadboard use.
 

Search ebay or Search AliExpress

Trimmer potentiometers RM065

Variable resistors suitable for breadboard use.

Search ebay or Search AliExpress

Male and female 2.54mm headers

Headers enable breakout boards to be fitted to breadboards.

Search ebay or Search AliExpress


Personal recommendations

For those who have never soldered before it is tempting to go for the Arduino UNO R3. However, soldering is not difficult and can be learned in half an hour alongside someone who has done it before.

At some point it will be necessary to solder because some components come with headers (legs!) that need fitting before use.

Once you have taken the leap to learn to solder I suggest you start off with:

  • A few Arduino Pro Mini boards. These are very low cost so it is not a disaster if you damage one.
  • A couple of USB to serial adapters to program the Pro Mini from a PC. Look for those containing the CH340 or CP2102 chip.
  • Two or three breadboards of each size: small, medium and large.
  • A jumper wire kit of stiff flat jumpers. I use the KS-350 Jumper Wire Kit.
  • DuPont jumper wires: male to male, male to female and female to female in 10cm and 20cm lengths.
  • Tools: soldering iron, solder, side cutter set, vice, multimeter.

A low-cost hobby

The list below shows typical prices for items mentioned on this course. These prices are based on ebay and other sources in the UK.

Component (non-tool) prices would probably be between 30% and 50% less if ordered from China - but there would be a two/three week delivery delay.

There are very few hobbies that one can get into for under £150 and guarantee hours of happy fun as well as learning a new skill.

You don't really need the Arduino UNO R3 (we will stick to the Pro Mini) or 12V battery - that saves £17.00!


Sources

Ebay is usually very good - but make sure the supplier is in the UK or you will have to wait two/three weeks for things to arrive from China.

Aliexpress is excellent and very low cost - but there will be a two/three week delivery delay.

When checking prices on Aliexpress look for bulk buys. For example: searching for arduino pro mini 5V atmega328 10pcs would give prices for 10 Pro Mini boards.

Specialist suppliers are very good, though slightly more expensive than ebay. Click on any of these to go to their web site:


Soldering

A soldering iron is very hot - it can not only burn you but it can also burn or melt things on your work bench if you dont take care.

Solder splatters are very hot so wear some form of eye protection.

Lead in solder can be poisonous - so wash your hands after soldering.

Most of the vapour produced during soldering is the "flux" in the solder designed to prevent oxidisation and to help it flow - so work in a well ventillated area.

Soldering may seem scary - especially to a non-practical person like me!

However, it is a skill that can be mastered in a few minutes - at least to the level we require to work with microcontrollers and breadboards. Being able to do it will greatly expand what you can do with micros.

Let's take a practical task - soldering the legs to an Arduino Pro Mini.

Step 1

You will need: vice, soldering iron, solder, Pro Mini, small breadboard and some Blu-Tack.

  • Set the soldering iron temperature to 400 degrees C and let it warm up.
  • Dampen the sponge pad on top of the soldering iron base.
  • Wipe the soldering iron tip on the sponge as soon as the correct temperature is reached. You should repeat this cleaning process regularly as you use the soldering iron
  • Touch the end of the solder to the tip of the soldering iron so a small amount of solder adheres to it. You don't want a blob of solder, just a very thin coating on the tip. This process is called "tinning".

Step 2

Use the Blu-Tack to hold the right angle header to one end of the Pro Mini board and the two vertical headers to the holes marked A4 and A5.

The Blu-Tack will hold the pins in place when you turn the board over to solder them.

Step 3

  • Put the Pro Mini board upside down into the vice.
  • Touch the tip of the soldering iron to one of the legs where it comes through the board then touch the end of the solder to where the tip and pin meet. The solder will flow on to the pin and, after about a second, you can remove both the iron and the solder. You should see a tiny pyramid of solder rising up the pin.
  • Don't solder the other pins yet.

    Take the Pro Mini from the vice and check that all the pins are still correctly in place. You have only soldered one pin so at this stage it is easy to adjust things by touching the soldering iron tip to the joint if required.

  • Put the board back in the vice and solder the remaining pins - and those of the vertical two pin header.

Step 4

  • Put a small breadboard into the vice then push two 12 pin vertical headers into the board - long legs down - as shown in the photo.

    One line will be two holes out from the central channel, the other will be three holes out.

  • Put the Pro Mini, face up, onto the pins. Take care to line the pins with the holes before pushing gently down - you want the short legs of the pins to come up through the board.

Step 5

Solder the 24 header pins to the board. Wipe the soldering iron tip on the sponge pad after every few joints.

Wipe your soldering iron tip on the sponge pad, return it to its holder and switch off.

Your Pro Mini is ready to use - though you may need to lever it carefully from the breadboard using the flat end of a screwdriver.


Time for a cup of tea and a biscuit.


Click for: part 1, part 2, part 3, part 4, part 5, part 6, part 7, part 8, part 9