Archive for March, 2009

Assembling the Freeduino (Arduino) Motor Shield

Thursday, March 12th, 2009

Assembling the ArduinoTM Freeduino Motor Shield

SCHEMATICS (click on images to enlarge)
freeduino motor schematic

The Freeduino Arduino Motor Shield is the original Motor Shield V1.1 designed by David Cuartielles of the Arduino Team. This product is not certified nor endorsed by David or the Arduino Team.

The new version of the KIT features a white PCB.  The capacitor placements were slightly changed to avoid touching the USB connector.  The board has 2 parts, the motor driver and the encoder.  The KIT only includes the components to assemble the motor driver.  In the new PCB, the components for the motor driver are marked with a *.  You only need to solder the components market with * to have the fully functional motor shield.  The encoder components soldering is optional.

First, unpack the kit

freeduino motor KIT

freeduino motor KIT

and start with the PCB. The PCB has some extra space for an encoder. It is optional to assemble the encoder section. The kit only includes the components to assemble the motor control section of the PCB.
Let’s start with the IC sockets using the following parts:

IC Socket 1 14-pin IC socket
IC Socket 2 16-pin IC socket

Freeduino motor KIT

Freeduino motor KIT

Then, we can solder the resistors and the LED.

PWR 3mm LED
R7 1K resistor
R3, R4, R5, R6 100K or 68K resistors

The LED has two legs, one longer than the other. The longer leg is called ANODE (+) and the shorter is CATHODE (-). The LED goes in the PWR LED space. Insert the long leg into the left hole.

Then solder the 1K R7 resistor, and the four 100K (or 68K) R3 to R6 resistors.


Freeduino motor KIT

Freeduino motor KIT

We continue with the capacitors:

C4, C9 100uF electrolytic capacitor
C10, C11, C12, C13 100nF ceramic capacitor

Freeduino motorKIT

Freeduino motorKIT

This is the board with all the components installed, before we solder the sockets.

NOTE: The C9 capacitor was installed backwards in the picture. Follow the marking on the PCB, which is positive down, negative up.

Freeduino motor KIT

NOTE 2: In the new version of the PCB (white), the picture shows the capacitor C9 correctly soldered.

Freeduino motor KIT

Solder the rest of the components: male sockets to plug the shield to the Freeduino / Arduino board, and the 4-pin female socket to plug the motors.  The 4-pin female socket was replaced by male pin header.

Freeduino motor KIT

Freeduino motor KIT

The motor shield, completely assembled and ready to use.

Freeduino motor KIT

Freeduino motor KIT

You can connect two DC motors. One goes on the first 2 socket holes (MOTOR B), from the top.  The new version (white) includes male headers for the motors.
Freeduino motor KIT

The second motor (MOTOR A)goes on the 2 bottom socket holes.

Freeduino motor KIT

A simple Arduino code to test the shield:

// Motor Shield test
// by NKC Electronics
// Test Motor B

int dirbpin = 12; // Direction pin for motor B is Digital 12
int speedbpin = 9; // Speed pin for motor B is Digital 9 (PWM)
int speed = 200;
int dir = 0;

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

void loop()
{
digitalWrite(dirbpin, dir); // set direction
analogWrite(speedbpin, speed); // set speed (PWM)
dir = ((dir == 0) ? 1 : 0); // change direction
delay(10000); // 10 seconds
}

Motors can be any DC motor that can work up to the Vin voltage. Vin is the power supply voltage – 0.6V. If you are using a 12V transformer, then Vin is 11.4V. You can use a 12V motor. If you are using a 9V transformer, then Vin is 8.4V and you can use a DC motor rated at 9V.

The motor driver can support 3.6V to 36V motors (1A). But the shield is designed to take Vin from the Arduino / Freeduino power supply, before the 5V voltage regulator. You cannot supply Arduino / Freeduino with 36V without burning the voltage regulator.

If you need to use a motor rated < 7V or > 14V, you will need to modify the shield. Do not install the Vin pin header to the Arduino / Freeduino board (or install the Vin and GND pins upwards, to plug a connector from where you can supply this shield with a different voltage range than the Arduino / Freeduino board)… and install a socket and supply Vin in the Shield from a different regulated DC power source, using the same GND connection.http://www.nkcelectronics.com/arduino.html

Assembling the Freeduino Serial v1.0 Board

Thursday, March 12th, 2009

Assembling the ArduinoTM Diecimila Compatible Freeduino Serial v1.0 Board

SCHEMATICS (click on images to enlarge)
freeduino serial schematic

The Arduino diecimila compatible Freeduino serial board is a special version of the Arduino serial board designed by NKC Electronics. The board is diecimila compatible (autoreset) and includes the 13 digital pin LED for easy diagnostics and basic LED sketch execution.
First, unpack the kit

freeduino serial KIT

and start with the PCB.

Let’s start with the power portion of the schematic using the following parts:

DC1 DC power jack
D1 1N4004 diode
C5 100nF ceramic capacitor
C6, C7 47uF electrolytic capacitor
IC2 7805 5V positive voltage regulator
Power LED 3mm LED
R2 330 ohm resistor

Freeduino serial KIT

Plug a wall plug voltage regulator (+7V to +12V). The LED lights up, indicating that the Power supply is working.
Freeduino serial KIT

NOTE: This board is not shield friendly, as the 7805 is too tall and there is no room to install it horizontally.

If you need to use shields with this board, mount the 7805 on the bottom side of the board following the next pictures:

Freeduino serial KIT

Freeduino serial KIT

The result is shown with the XBee shield, Motor controller shield and NKC Electronics protoshield.

Freeduino serial KIT

Freeduino serial KIT

Freeduino serial KIT

Next continue with the soldering of the RS232 components:

Freeduino serial KIT

X1 DB9 female PCB adapter
T1 BC547
T2 BC557
D2, D3 1N4148
C8 10uF electrolytic capacitor
R1 4.7K resistor
R3 1.5K resistor
R4 1K resistor

Solder the rest of the capacitors and resistors:

R5-R9 10 Kohm resistor
C2, C3 22pF ceramic capacitor
C1, C4 100nF ceramic capacitor

Freeduino serial KIT

Now solder the crystal, switch and the 13-pin LED:

Freeduino serial KIT

S1 reset switch
13 3mm LED
Q1 16MHz crystal

Freeduino serial KIT

Now solder the headers and sockets:

ICSP 2×3 pin male header
POWER 4-pin female header
Analog In 6-pin female header
Digital 2 x 8-pin female header
IC1 28-pin DIP socket

Freeduino serial KIT

Pay special attention to the alignment of the female headers.

Freeduino serial KIT

And finally install the ATMEGA168 MCU.

Freeduino serial KIT

The board is ready to be used. Start Arduino0009 or Arduino0010 and load the BLINK sketch from the examples directory. Verify that ATMEGA168 is selected in Tools –> Microcontroller (MCU) and Arduino Diecimila in the Tools –> board option. Select the COM port number corresponding to the serial interface where the Freeduino serial board is connected to. Press the “Upload to I/O board” button in Arduino and the board should autoreset and complete the programming. If you selected correctly the BLINK sketch, the LED “13” must start blinking once every 2 second (0.5Hz).

http://www.nkcelectronics.com/arduino.html

Assembling the Freeduino Board KIT

Thursday, March 12th, 2009

Assembling the ArduinoTM Compatible Freeduino Board

SCHEMATICS (click on images to enlarge)
freeduino schematicfreeduino schematic 2

The Arduino diecimila compatible Freeduino board is a special version of the USB diecimila board designed by the Freeduino team using all through-hole components (except FT232RL chip), for easy assembly. The board was designed by Bill Westfield of the Freeduino team.

The latest board is v1.22 which schematic is exactly the same as v1.19.1 and V1.20.  v1.22 assembles exactly the same as v1.19.1, except for the F1 PTC resettable fuse and it includes the mini USB B socket, already presoldered to the board.

First, unpack the kit

freeduino KIT

and start with the PCB. The Freeduino board comes with the FT232RL chip,  PTC fuse  and mini USB B socket pre-soldered (v1.22 only), eliminating the most difficult task in the assembly process of the Freeduino board.

First assemble the USB portion of the board.

Identify and separate the following components:

R8 1Kohm resistor (RLED just below the power LED)
C13 4.7uF capacitor (dark yellow, marked 475 or 4.75)
LED 3mm green LED
C8, C10 100nF ceramic capacitor (brown and round, marked 104)
C4 10nF ceramic capacitor (small round brown, marked 103)
X1 mini USB B PCB jack (pre-soldered on v1.22)
SV1 3 pin male header
SHUNT Black shunt
F1 PTC resettable fuse (pre-soldered on v1.22)

Freeduino KIT
Solder the parts to the board, in any order. This completes the USB portion of the schematic.

Board v1.22 and V1.19.1: the F1 PTC resettable fuse is the blue or green rectangle marked LF050 and it is pre-soldered in the PCB.

Board V1.20: the F1 PTC resettable fuse is a through-hole component that looks very similar to a ceramic capacitor, but has markings like XF050. It must be soldered on F1.

This is how the PTC fuse for Board V1.20 looks like:

Freeduino KIT

And it must be soldered in F1:

Freeduino KIT

Plug the small shunt in SV1, shorting central pin and the top pin (USB). Install the FTDI drivers that are installed under the Arduino0009 or Arduino0010 directory. Connect the board to a Mac or PC. The LED in the board lights up and in windows you will hear a beep, indicating that windows identified an USB device. Unplug the USB connector from the board to continue soldering the rest of the components.

Freeduino KIT

After testing the USB interface, you can continue soldering the rest of the components, in any order you like. I prefer to complete the power portion of the schematic using the following parts:

DC1 DC power jack 2.1 mm barrel type
D1 1N4004 diode
C5, C12 100nF ceramic capacitor (round brown, marked 104)
C6 100uF electrolytic capacitor
C7 47uF electrolytic capacitor
IC2 7805 5V positive voltage regulator

Freeduino KIT

Move the shunt in SV1 to short the central pin and the bottom pin (EXT). This is the indication that the external power supply will be used, instead of USB. Plug a wall plug voltage regulator (+7V to +12V). The LED lights up, indicating that the Power supply is working.
Freeduino KIT

The kit can include a ceramic oscillator (orange component with 3 legs) or a crystal plus 2 x 22pF ceramic capacitors (small round brown, marked 22).  Picture of the installed ceramic oscillator:

Freeduino KIT

Picture of the installed crystal and 22pF ceramic capacitors:

Freeduino KIT
Solder the rest of the components:

R1 10 Kohm resistor
R11, R12 1 Kohm resistor
CRS, C1, C9 100nF ceramic capacitor (round brown, marked 104)
13, RX, TX 3mm LED
R7, R9, R10 1Kohm resistors (RLED)

Freeduino KIT

Freeduino KIT
Now solder the headers and sockets:

ICSP 2×3 pin male header
RESET reset switch
POWER, Analog In 2 x 6-pin female header
Digital 2 x 8-pin female header
ATMEGA168 28-pin DIP socket

Freeduino KIT

Pay special attention to the alignment of the female headers.

Freeduino KIT

And finally install the ATmega328 MCU (ATmega168 on older boards).

Freeduino KIT

The board is ready to be used. Start Arduino and load the BLINK sketch from the examples directory. Verify that ATmega328 (ATmega168 in older boards) is selected in Tools –> Microcontroller (MCU). Select the COM port number corresponding to the USB serial interface. If the port number is high (not in the 1-10 range), then you need to change it using Device Manager (in windows) to use a lower number. Press the “Upload to I/O board” button in Arduino and the board should autoreset and complete the programming. If you selected correctly the BLINK sketch, the LED “L” must start blinking once every 2 second (0.5Hz).If you use the new Arduino0010, you don’t need to worry about the COM port number being higher than 10 in Windows environment. In previous releases, COM port number needed to be 10 or lower. With Arduino0010, I have tested COM port numbers up to 36 and it is recognized perfectly.

http://www.nkcelectronics.com/arduino.html

JTAG ICE clone Assembly Guide

Thursday, March 12th, 2009

Assembling the NKC Electronics JTAG ICE CLONE Board

by NKC Electronics

SCHEMATICS (right click –> view image)

jtag schematic

JTAG ICE Clone board is an implementation of the Aquaticus JTAG ICE clone. The Kit includes the PCB and all the parts requiered to build a fully functional clone of AVR JTAG ICE. It can even be upgraded using AVR-STUDIO when a new firmware is released by Atmel.

First, unpack the kit and start with the PCB. The JTAG ICE clone board has all the component values printed on the PCB, making the use of the schematic almost unnecessary.

jtag PCB

Start by soldering the resistors R1 to R6

R1 10 K resistor
R2, R3, R4, R6 1 K resistor
R5 4.7 K resistor

jtag resistors

Next identify and separate the 2 22pF ceramic capacitors and solder them to the PCB.

C1, C2 22pF ceramic capacitor

jtag 22pf capacitors

Now it is time to separate and solder the 7 100nF (0.1uF) ceramic capacitors.

C3 – C9 100nF ceramic capacitor

jtag 100nf capacitors

Next solder the 10uF electrolytic capacitor and the 2 LEDS (PWR and JTAG). There is one RED LED and one GREEN LED. You can use any color for PWR and JTAG. LEDs have positive and negative legs. The positive leg is usually longer than the negative leg. In this case, the positive leg goes in the right pad, in both PWR and JTAG LEDS.

LED2 3mm RED LED
LED1 3mm Green LED
C10 10uF electrolytic capacitor

jtag led

Now you can solder the sockets, the 1N4148 diode and the crystal. There is one 40-pin socket for the AVR ATMEGA16 MCU and one 16-pin socket for the RS232 level converter chip.

Q1 7.3728 MHz crystal
D1 1N4148 diode
IC1 socket 40-pin DIP socket
IC2 socket 16-pin DIP socket

jtag sockets

Last step is the soldering of the female DB9 socket, the JTAG 10-pin header and the MODE 3-pin header (with the shunt). When you solder the JTAG 10-pin box header, the number 1 mark for the first pin will desappear under the box header, so please always remember that pin 1 is the upper left pin.

X1 DB9 female PCB mount jack
SV1 10-pin box IDC male header
JP1 3-pin male header
shunt shunt

jtag io

We are done with the soldering. You need to install the MCU and the RS232 driver in the sockets. The large chip is the ATMEGA16 Microcontroller. It is already programmed with the latest release of the JTAG ICE firmware, and the bootloader. Please, be very careful with the pins while inserting the ICs.

IC1 ATMEGA16-16PU MCU
IC2 ST232ABN or HIN-232 (MAX232 compatible IC)

Insert the shunt shorting positions 2-3 of the 3-pin MODE header. The JTAG ICE clone board has two modes of operation:

  1. Programming / Upgrade mode
  2. Normal operation mode

Position 2-3 is the Normal operation mode (board is ready to connect to target board and start debugging)

jtag normal

Position 1-2 is the Programming mode. This mode is used to program or upgrade the JTAG ICE firmware. The firmware is distributed by Atmel with updates on the AVR Studio IDE. In the operation guide you will find the manual firmware upgrade process, explained in detail.

jtag program

This is how the JTAG ICE clone board looks ready to use, connected to the serial port of the PC and the target board.

jtag connected

The target board must supply the power to the JTAG ICE clone board, using the standard JTAG connector. The board expects the power from the target board (2.7V to 5.0V) in the VTarget (VCC) pin. It is recommended to supply also the target voltage to the VTref pin. Usually you can connect the VTarget pin to the VTref pin. The JTAG ICE board does not have voltage leveling circuit, so if you supply VTref, it must be the same as VTarget.

Testing the board:

  1. Start AVR Studio
  2. Verify mode jumper is in 2-3 Normal
  3. Connect JTAG port to target board. Supply VCC. At this point, you only need to supply VCC to the JTAG ICE clone board. No real circuit with target MCU is needed
  4. Both LEDs are on
  5. Select Connect to the Selected AVR Programmer avr studio connect
  6. You should see the following message: jtag avrstudio ocd error

This message means that AVR Studio detected the JTAG ICE clone board, but was not able to identify the target MCU (either it is not installed, or the installed MCU does not support JTAG).

The JTAG ICE clone board is now assembled and tested. Now you need a real target board to start debugging.

An important reminder: JTAG ICE requieres the JTAG fuse in the target MCU set: JTAG Interface Enabled [JTAGEN=0]. The setting looks like this in AVR Studio:

jtag avrstudio fuses

IMPORTANT NOTE to AVRStudio 4.13 sp2 users: There seems to be a bug in AVRStudio 4.13 sp2 that generates an error trying to read fuses using the JTAG interface. There is a fix posted in Atmel Norway website: http://www.atmel.no/beta_ware/as4/413sp2/stk500Dll.zip

Digital Oscilloscope Tutorials for Hobbyists

Thursday, March 12th, 2009

I am an electronics hobbyist. I enjoy doing electronics and building things that have some electronic component inside. Usually hobbyists have more time to enjoy the process of doing electronics, but we could use some help, sometimes. What kind of help? Well, the introduction of affordable Digital Oscilloscopes (There are 25MHz digital scopes for $499 or less!) opens a new world of possibilities for the hobbyists. There is one problem when you are a hobbyist, you don’t have a formal training in electronics and electronics test equipments and you need some basic information on how to evaluate a digital scope, written by hobbyists for hobbyists. Some basic tutorials on how to use some of the handy features of DSO (Digital Storage Oscilloscopes) and MSO (Mixed Signal Oscilloscopes) could be useful as well. So I decided to write some tutorials telling other hobbyists my own experience with DSO and MSO. I will be using Rigol DSO and MSOs. In September 2007, I was exactly in the same position as you are, evaluating what DSO to purchase. I evaluated (virtually, through the Internet) many options (all entry level scopes) and I decided to purchase a Rigol DS1102CA, because of its price/performance. The evaluation took more than one month! I am very happy with the scope.

I will be using different Rigol equipment in my tutorials. In each tutorial, I will present a link where you can purchase the instruments I used.