Skip to content
Gergely Takács edited this page Apr 18, 2019 · 56 revisions

Header

So you've got a Carduino...

I probably wanted to impress you, which obviously worked... After all, you took the trouble of following the link printed at the back of the business card and are reading this page.

But what is this thing?

The "Carduino" is a business card of Gergely Takács, that also doubles as a microcontroller prototyping board. In other words, the Carduino is essentially a miniature computer with some assembly required. To use it in its latter function, you will need to populate it with electronic components and this guide is designed to help you with that. After assembly the Carduino can be programmed easily with any computer using the Arduino IDE, since it is compatible with the Arduino Nano single board computer.

Microcontrollers, such as the one meant for the Carduino are ubiquitous in our modern world. They are cheap single-chip computers governing everything from washing machines to engine control. A microcontroller board such as this can be a basis of many amazing projects, ranging from robotic arms, experimental medical devices to help the blind and to... erm... fart controlled TV remotes.

Header

Let's complete the Carduino!

The first order of business is to determine the version of the Carduino, that is printed on the PCB.

Completing the hardware

To complete the Carduino you will need an assortment of parts and equipment to mount these on the PCB.

Parts list

The part list required to assemble the Carduino R2 is shown below. Note that in many cases, especially with the LED, resistors, capacitors, you may simply replace the components for equivalent products of different suppliers. The part numbers and the URL for the components is shown only as an example.

Name Pcs. Designator Detail Part no. (e.g.)
Microcontroller 1 U1 ATMEGA328P, TQPF32 ATMEGA328P-AU
Oscillator 1 X1 CFPS-72, 16 MHz, SMD SPXO018034
USB connector 1 J2 USB B micro socket, SMD, 5 pin 1981568-1
USB-UART 1 U3 FTDI FT232RL, SSOP28 FT232RL-REEL
Fuse 1 F1 500 mA, 0805 SR050-06
LED 4 D1-D4 0805, RED OSR50805C1E
ICSP connector 1 J1 3x2 male header, 0.1" pitch DS1021-2*3SF1-1
Voltage regulator 1 U2 5 V, 0.95 A, SOT223 LD1117S50-TR
Push button 1 SW1 tactile, 4.5 x 6.5 mm pitch 1301.9301
Capacitor 2 C2, C5 4.7 μF, Tantalum, Case B 293D475X9025B2TE3
Capacitor 5 C1,C3,C4,C6,C7 ceramic, MLCC 0.1 μF, 0805 C0805C104K3RACTU
Resistor 7 R1-R7 1 kΩ, 0805 HP05W3F1001T5E
Diode 1 D5 Schottky, DO220AA SS1P3L-M3/84A

Soldering tips

If you have never tried soldering surface-mount components, I can assure you that the job looks a lot harder than it is in reality. You will need a decent soldering iron, flux, solder and a little bit of experience. Once you get the hang of it, it is surprisingly easy. It is, however, out of the scope of this little tutorial to teach you soldering.

Here are some specific tips to finish the Carduino:

  • The hardest component to solder is the USB connector. This particular model has pins that are essentially under the body of the connector and hard to reach with a normal soldering iron tip. I'd suggest you use a sharp and thin tip for this one.
  • The second difficult part is the FTDI chip, which is quite finely pitched. If you are used to soldering TQFP package components, this is a harder cookie. Use a sharp tip and wick bridges if necessary.
  • The rest of the components are quite easy compared to the previously mentioned USB connector and FTDI chip. Most components are in a hand-finish friendly 0805 package, and the atMega 328p-'s TQFP package should not be a challenge either.
  • Equipment-wise, I've used an ESRA RDS80 soldering station with a sharp pointy tip and a small flat one. The solder was 60/40 leaded, since it is easier to use. Make sure you have some solder wick, a set of tweezers and, most important of all, flux. Good flux makes wonders, and it contributes more to success than a steady hand or technique. SMD soldering is more about chemistry, than fine-motor skills.

Completing the Software

First plug in

After soldering the components it is time to plug your Carduino into the computer for the first time. The LED marked with "ON" (the top one) should light up. If this has not happened, I suggest you go back checking the connections of the components near the power supply circuitry clustered to the right side of the device. Are the USB connector pins soldered properly? Isn't the protection diode backwards?

In case the "ON" LED has lit up the next milestone is setting up the communication with your computer. On a Windows machine the operating system should recognize the FTDI USB-Serial converter chip and begin searching for the correct drivers.

Connecting

If this is happening, that means that the connection to the FTDI chip itself is correct. Otherwise check the USB connector pins and the FTDI chip itself. This IC is quite densely pitched, it is easy to mis-align the pins on the PCB or bridge them with solder. If the search for the correct drivers has begun, you can check the progress; it should first recognize the FTDI chip, then install it as an USB-Serial interface.

Connecting

Upon a successful installation, the computer will announce the virtual COM port. The number will likely differ on your own computer, but you should remember - as this will be needed in the Arduino IDE as well...

Connecting

After the driver installation is finished, the FTDI chip is ready to be used.

Connecting

However, the Carduino is not complete yet, because the 328p does not contain the bootloader.

Burning the Arduino Bootloader

This tutorial helps you to burn the Arduino bootloader for the "Carduino" using an in-circuit programmer and Atmel Studio.

There are several tools you can use for flashing the bootloader, both in the hardware and software departments. I will describe the ones I had available and installed, the scope of this tutorial does not allow for a comprehensive overview.

So, I will assume you have the freely available Atmel Studio installed on your computer, and an in-circuit programmer and debugger (ICSP) like the Atmel Ice. The following screenshots are from Atmel Studio 7 and I've used the aforementioned Atmel Ice programmer.

Connect the six pin ICSP female header to the ICSP male pins on the Carduino. The dimple on the programming header should point upwards to the top of the PCB. Some programmers, such as the Atmel Ice do not provide power to the programmed MCU, thus the Carduino should be connected to the computer for power. If there is a LED indicator for power on the programmer, this should be on by now.

First, you must open the device programming tool by pressing Ctrl+Shift+P or by clicking the button that looks like an integrated circuit hit by a lightning bolt:

Programming Button

Select your programming tool in the Tool drop-down menu, then select the atMega 328P microcontroller from the Device menu and finally, select your ISP from the Interface menu. After clicking apply, the connection to the microcontroller is configured. If you click the Read button next to Device signature, a hexadecimal sequence should appear. This sequence (0x1E950F) indicates the particular type of chip. If you have succeeded, that is good news, since it means that the connection from your computer via the programmer to the microchip is established.

Connecting

Now you will need to switch to the Memories tab by the menu on the left. In Flash click on the three dots and navigate to the bootloader *.hex file. The file called ATmegaBOOT_168_atmega328.hex contains the functionality that allows the Arduino IDE to program the MCU without an ICSP. This bootloader can be found in the installation directory of the Arduino IDE or I have included a copy in this repository.

Navigate to the file and click Program. After some messages, the window should say Verifying Flash ... OK or something similar, indicating that the bootloader has been flashed to the microcontroller.

Connecting

We are not quite finished yet. Navigate to the Fuses option in the menu to your left. The fuses will configure some very basic options for the microcontroller, including the source of the clock signal.

A word of caution for those using this tutorial for a generic Arduino Nano. The Carudino uses an oscillator not a crystal for its clock signal. If you use the fuse settings below, you will brick your device and cannot make it work again unless you can find a full-swing TTL signal to apply to the correct pin. So the fuses settings shown belove are not valid for the Arduino Nano.

That said, we want to configure a boot Flash size of 1024, and more importantly an external clock signal. The correct fuse settings are EXTENDED 0x05 HIGH 0xDA LOW 0xE0.

Connecting

Click on program, and a warning will pop up. This, essentially, just lets you know that unless the correct physical clock source is supplied to the MCU, it will stop working. This includes any attempts to program it or correct the fuses. You can make sure that the oscillator works by hooking it up to an oscilloscope. You should see a 16 MHz triangle signal.

Connecting

Confirming the operation by clicking Continue will set the fuses. The window will let you know that the correct fuses have been set by listing Verifying registers ... OK.

Almost done, but we should now set the lock bits. Click to the Lock bits menu option on the left and set LOCKBIT: 0x0F, then hit Program. If all went well, you will see Verify registers ... OK again.

Connecting

The bootloader is now in place and you can close Atmel Studio and remove the ICSP header.

First use

If all went well, your Carduino is complete. You can use it like any other Arduino device and program it through the Arduino IDE.

First you must select the type of board to program. The Carduino is fully compatible with the Arduino Nano, so go to Tools->Board and select Arduino Nano.

Connecting

The bootloader we flashed to the device is known as the "old" bootloader. To select the type of processor and bootloader, go to Tools->Processor and select ATmega328P (Old Bootloader).

Connecting

The last thing to do is to tell the Arduino IDE which virtual serial communication port should it use to communicate with the Carduino. This can be set in Tools->Port to the correct port, e.g. COM23 but of course yours is likely to differ in the number.

Connecting

Before you upload your first program, make sure that the lower right corner of the Arduino IDE says Arduino Nano, ATmega328P (Old Bootloader) on COMx, where x is the location of the Carduino.

Connecting

Now its time to test the board with the "Hello World" of the embedded world: blinking the onboard LED. For this, navigate to File->Examples->01.Basics->Blink, or copy the code below to the editor:

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);   
  delay(1000);             
  digitalWrite(13, LOW);    
  delay(1000);              
}

All you have to do is hit the button that looks like an arrow pointing to the left, alternatively navigate to Sketch->Uploador hit Ctrl+U and your program is flashed to the Carduino. The onboard LED should now blink, meaning that the Carduino is ready for more advanced and exciting projects.

If, at this stage, the Arduino IDE shows some sort of communication error, you must go back to the previous steps. The error may be hardware related, then you should carefully check the connections on the USB connector (unlikely if the operating system recognized the chip) and the FTDI chip itself. Make sure that the microcontroller is aligned and soldered correctly. The other possibility is that you have a software error or some of the fuses are set incorrectly. Try to re-flash the bootloader and set the correct fuses.

Carduino design

As the logo on the back of the Carduino indicates, this device is open-source and you can find everything necessary to understand its design here. The Carduino is essentially an Arduino Nano, thus its design has been based on the Arduino Nano revision 3.2. This in turn has been founded on the design made by Gravitech, thus the Carduino stands on the shoulders of giants. All of these devices, just like the Carduino, are released under the Creative Commons Share Alike 3.0 License.

Schematics

The PDF printout of the Carduino schematics can be downloaded from here. The schematic representation of the Carduino is divided into various sub-units. Let us start from the top left corner, where you can find the programming connector (ICSP), which is directly hooked up to the microcontroller. Below that is the power supply circuitry with the voltage regulator chip in the middle. This takes the voltage source from USB and pre-filters it with a 4.7 μF then a 0.1 μF capacitor. The output of the chip is post-filtered by the same couple of capacitors in a reversed order. Below the power unit are the LED indicators for RX, TX, power and the customary programmable D13 indicator. The voltage to the LED is modified by the 1 kΩ series resistors. Below that is the representation of the standard 0.1" pitch header connector on the sides of the Carduino. These map the customary notation of Arduino pins to the actual I/O of the microcontroller. The last unit on the bottom left is a Schottky diode, essentially in the role of a voltage auto-selector.

Move on to the microcontroller itself. The power to the microcontroller is supplied by the circuitry described above. The analog reference includes a decoupling capacitor, while the serial line is connected to the FTDI chip through 1 kΩ resistors. Instead of a crystal, this design uses a full-swing oscillator connected to the OSC1 pin of the MCU. The oscillator itself needs a voltage source and a ground connection, while its pin no. 1 remains unconnected. Last, but not least the reset circuitry of the MCU is pulled high by a fairly strong 1 kΩ resistor, this is then connected to the tactile switch for manual reset.

The bottom right corner of the schematic documentation shows the USB connector and the USB to serial converter chip. As power is normally drawn from the USB, a polyfuse protects the device and the computer from unintentional short circuits. The USB connector then is connected to the common ground and the two communication lines are hooked up to the FTDI chip. The chip provides the 3.3V regulated output, this is connected to the 3V3 pin through a decoupling capacitor. On the "output" side, the FTDI chip is cross-connected with the MCU using the serial line, while input and output activity is signified by the LED described above.

Schematics

Printed circuit board

The PCB design is limited to two layers, first because no more is needed in reality and also to minimize the cost of the business cards. The arrangement of the components is, of-course, subjected to the original intent of the device: it is after all a business card. Thus, all components are located on the top layer only and are arranged close to the bottom edge as possible, to make room for the silkscreen imprint of the logo and other information. A denser arrangement of components is naturally possible, however, I have tried to make hand-soldering relatively easy.

Production files

The production-ready CAM files for the PCB can be downloaded here.