Table of Contents
Sample text
This is a sample of the contents of the full e-book.
The sample contains the introduction and Chapters 1 and 3.
The full e-book has an introduction, four chapters and an appendix.
Introduction
This e-book was originally written to support a workshop at the BCS SPA conference 2014. You can use it
- as a workshop participant
- working on your own
- as a leader running a non-commercial workshop that you’ve set up
If you want to use it for a commercial workshop, please contact romilly.cocking@gmail.com to discuss a commercial license.
The workshop lasts one to two hours.
What you will need
You’ll need
- A laptop with a spare USB port
- A kit of parts.
If you are building a Shrimp on your own, the bootloader section below explains an important choice you need to make before ordering the parts for your Chip.
You’ll find a parts checklist in Check your kit in chapter 2. Sources for the parts are in Appendix 1.
The bootloader
There’s one other component that is part of the Arduino and the Shrimp. It’s a software component called a bootloader.
The bootloader’s job is to help you upload your own programs (sketches) to the Arduino.
If you’re using this in a workshop your workshop leader will tell you whether your chips have a bootloader installed, and will explain how to install one if they don’t.
If you’re working on your own, you will have to chose from the following.
- You can buy your own components, including an ATMega328p with a bootloader installed. Some suppliers are listed in Appendix 1. Chips with a bootloader typically cost about £5/$7.
- You can use a commercial In-system Programmer (ISP) to install the bootloader, or build an open-source design. The cost varies widely between £15 and £100; you probably won’t want to buy one if you are just starting out in electronics.
- You can buy or borrow an Arduino and use it to install a bootloader yourself. You’ll find instructions here but these are based on a slightly different breadboard layout to the one used by the Shrimp.
Installing the Arduino IDE
Later in the workshop you will upload a new sketch (program) to the Shrimp. You’ll do so using the Arduino IDE.
That’s an application which runs on your laptop. It allows you to edit, compile and download programs to an Arduino or your Shrimp.
It would be helpful if you install it before you start working on the electronics.
You should use Arduino version 1.0.1 or later. Do not use the experimental 1.5.x series.
Instructions for installing the IDE depend on what operating system you are using.
Details here
Credits
I would never have written this eBook without the inspiration and encouragement of Cefn Hoile. Cefn and his collaborators invented the Shrimp, sourced the parts, and documented the build process.
This e-book uses many of his copyright materials (with permission). In the appendix I have recommended that you get components for your future Shrimps from the Shrimping It! website which he runs.
Not only are the prices very competitive, but the service is super.
The diagrams were originally created using an excellent free electronic design program called Fritzing. They were exported as SVG and edited using another great free program called Inkscape.
I’d like to thank Al Duncan (@ve3rrd) who helped to enhance some of the photographs used in this and earlier versions of the e-book.
One of the reasons I enjoy being part of the Maker movement is that it’s full of kind people who willingly help others to learn and make. I hope you will feel the same.
Build your own Arduino clone
What’s all the fuss about?
Arduino have sold well over a million boards since 2006. People love it because
- It’s easy to get started. You can blink a LED within a couple of minutes of installing the free Arduino Interactive Development Environment (IDE).
- There’s a huge, supportive community who help with problems, give feedback about code and designs, and offer advice about projects.
- There are hundreds of compatible add-on products to sense and control the physical environment.
- The hardware is inexpensive, and because it’s open source, you can build even cheaper alternatives.
A ready-made Arduino board is a great way to get started. You can also take a lower cost approach, and learn useful skills in the process.
In this workshop you will make your own computer, the Shrimp, which is compatible with the Arduino but is much cheaper to make.
The Shrimp was created by the Makers of Morecambe. It’s perfect for classroom use, and it’s a great way to learn more about how the Arduino works.
In the UK an Arduino Uno costs over £20. If you are buying a single kit, the Shrimp costs about £4, and the breadboard costs £1. The CP2102 (used to program the Shrimp) adds about £3 to that, but the cost of the CP2102 can be shared across projects or between people. Buying components in bulk you can reduce the costs still further.
Let’s compare the Arduino Uno with the Shrimp.
The Arduino Uno
Here are the key components:
1. The Microcontroller (an Atmel ATMega328p) stores your programs (sketches) and interacts with the real world
2. The female headers are used to connect the Arduino with the outside world
3. The USB connector can be used to power the Arduino, load new programs, and interact with a host computer
4. The crystal provides the Arduino with a clock signal that helps keep everything in step
5. The reset button allows you to tell the Arduino to restart a program from the beginning
6. The FTDI chip converts the USB signals to serial communications signals that the microcontroller can interact with
7. The voltage regulator is used to create a 5v supply if you power the Arduino from a battery or wall wart (mains power supply)rather than a USB connection
8. The LED can be used by programs to signal what’s going on.
The Shrimp
Here’s the Shrimp you’ll be building in this workshop. This version has:
- A board with the CP2102 which connects the Shrimp to your computer’s USB port and provides power to the microcontroller.
- A microcontroller chip - the brains of the Shrimp. It’s made by Atmel, and it’s an ATmega328p.
- A push-button to restart your Shrimp, and a green jump wire to link it to the chip.
- A crystal which controls the speed of the microcontroller; above it, and to the right, a couple of capacitors (marked 22) to help the crystal work correctly.
- A resistor to make sure the Shrimp starts up correctly when powered on.
- A capacitor marked 104 which lets your computer restart the Shrimp when a new program is uploaded.
- A set of header pins to connect it to the CP2102 which links your computer to the Shrimp.
- Two jump wires (one red, one green) to link up power to the chip.
- Four more capacitors to smooth the power. Three are small, and marked 104; one is large, marked 10μF.
- An LED (with another resistor) so you can check that the Shrimp is working correctly.
You can read more about the components in the descriptions of the assembly steps which follow.
Uploading a new sketch
Once you’ve got a working Shrimp (clone), you’ll want to program it.
The Arduino documentation talks about uploading sketches to an Arduino. A sketch is Arduino’s term for a program. The Arduino was originally targeted at artists - hence the term sketch.
The Arduino IDE
The Arduino IDE is a program that runs on a conventional computer. It helps you code, upload and communicate with your Arduino or clone.
Drivers
As well as the Arduino IDE, you will need an appropriate driver to communicate with the CP2102 board.
If you’re running Linux, you are in luck. Modern Linux distributions come with an appropriate driver.
If you’re running Windows or OS/X, you will need to install the driver. You can find details here, under the heading for technicians.
Starting the IDE
Start the Arduino IDE. The way you’ll do this will depend on your operating system. Ask for help if you are unsure how to do this.
The IDE Window
This is the window you will see once the Arduino IDE starts up. It will open a new sketch window.
Selecting the Board
From the IDE Tools menu, select the Board option. The clone you’ve built has a bootloader for the Arduino Uno so select that option
Selecting the Port
From the Tools/Port menu, select the port that corresponds to the CP2102. It’s probably the only port in the list. If there’s more than one, you can try unplugging and replugging the CP2102 and seeing which port disappears and returns.
If you’re running Linux and you can’t see any ports in the list, you may need to add yourself to the dialout group. You’ll need to log off and on again for the change to take effect. |
The Blink sketch
To check your board is fully functional, you’re going to upload an example called blink, then change it slightly and see the behaviour of the board change.
Uploading
From the File menu of the Arduino IDE, select examples/01 basic/Blink.
You should see the source code of the blink example.
Now click the second icon of the row at the top if the IDE. It has a tooltip upload.
You should see some activity at the bottom of the screen, with a progress bar. After a short time you should see the message done uploading appear in the status bar near the bottom of the IDE.
Congratulations! You’ve programmed your Shrimp!
If you don’t see the done uploading message, you will see some red text in the pane at the bottom of the window. Time to do some troubleshooting! |
Change the sketch and upload again
Now edit the text in the IDE main pane. You should be able to find two lines that read delay(1000). These determine that the LED is on for one second (100 ms) and then off for one second.
Change each number from 1000 to 100, and upload the sketch again.
Now the LED should blink on and off every tenth of a second.
Congratulations!
If everything has worked, you’ve nailed it. (That’s English slang for you’ve mastered this)
Pack up your Shrimp in its box, take it home and play! The next section of this eBook has a suggestion for what to do next.
What next?
Creating a permanent version of your project
Breadboarding is a great way to prototype things quickly, but once your project is working you may want to make a more permanent home for your hardware.
One great way to do that is to use solder and stripboard.
The Shrimping It! website offers a low-cost stripboard kit that’s perfect for Shrimp-based projects, and it has diagrams showing what the stripboard version looks like.
If you’d like more detailed information about building a Shrimp on stripboard, I posted a short guide on my blog.
Learning more techniques
You’ll also want to experiment with more advanced techniques than just blinking an on-board LED.
The Arduino community has created a huge amount of information about the platform - so much that it can be a bit daunting at first.
If you’d prefer to ease into some additional practical experiments I am about to release a new low-cost e-book called Life after Blink!.
Like this book, it will be available on Leanpub. That means it will be a risk-free purchase, as you’ll benefit from Leanpub’s unconditional 45-day guarantee. You’ll also be able to try before you buy as there will be some sample content available.
To register your interest, visit the book’s Leanpub Page and you will be notified by email when the e-book is available.
Feedback please!
Please help me to improve this and future books. There’s a short online survey which you can complete in five minutes or less. I’d really appreciate it if you could take the survey while this book is fresh in your mind!