NKC Electronics Tutorials
1 of 29
http://mcukits.com/
NKC Electronics Tutorials NKC Electronics Tutorials
NKC Ethernet Shield for Arduino Assembly Guide April 22nd, 2009
This is the assembly guide for the NKC Ethernet Shield for Arduino DIY KIT. This shield is based on the WIZ812MJ module and shares the same W5100 TCP/IP chip with the official Arduino Ethernet Shield, making it 100% compatible. The current Arduino Ethernet Shield doesn’t work with the Arduino MEGA (a hack is possible, but some wiring is needed, as well as a small modification to the Ethernet library code). The NKC shield was designed to avoid this extra wiring and make it physically work with both the Arduino boards (and all its derivatives) and the Arduino MEGA board. The KIT (purchase) comes with all the components, as shown in the next picture:
Start by opening the plastic poach and removing all the components on the table. Select the PCB, the 3.3V voltage regulator (TO-220 format) and the 2 x 100uF electrolytic capacitors. Solder these components, make sure that the capacitors are correctly oriented, as they are polarized (long leg is positive, short leg negative. Also negative has a band on the capacitor body).
Next proceed with the LEDs, resistors and tactile switch. The switch is for resetting both the Arduino board and the Ethernet shield. The red LED is for LED13, the same LED13 that you have in your Arduino board is available on the Shield, as it indicates SPI activity. The 2 blue LEDs are for the Ethernet TX and RX activity indicators. The resistors are for limiting the current to these LEDs.
6/22/2009 2:12 AM
NKC Electronics Tutorials
2 of 29
http://mcukits.com/
Now solder the 4 2×5 female sockets. Before applying solder, make sure they are correctly aligned.
It is time to solder the long legged pin headers: 2 x 8-pin, 2 x 6-pin and 1 x 2×3-pin (this one goes upside down!). There is also a 4-pin male header and a jumper or shunt.
The shield is ready. Plug the jumper in “Duemilanove” position (1-2). Insert the WIZ812MJ module as shown:
6/22/2009 2:12 AM
NKC Electronics Tutorials
3 of 29
http://mcukits.com/
This is how it looks, mounted on a Freeduino board (Arduino diecimila, duemilanove, seeeduino, etc):
and the next step is to open the Arduino IDE, load some Ethernet library based sketch and enjoy your new Ethernet Shield. If you have the Arduino MEGA board This is how it looks:
6/22/2009 2:12 AM
NKC Electronics Tutorials
4 of 29
http://mcukits.com/
You can keep the jumper in the Duemilanove setting.
1. Locate spi.h file (it is located under Arduino installation directory –> hardware –> libraries –> Ethernet –> utility) 2. Rename it as spi_orig.h 3. Download spiMEGA.h 4. Rename spiMEGA.h as spi.h 5. Delete all .o files from utility and Ethernet directories 6. Start the Arduino IDE 7. Load or program your Ethernet Library based shield 8. Compile –> upload sketch to the MEGA –> and Voila!!! 9. Enjoy your Arduino board connected to the NET The jumper in MEGA position, together with the last pin (4) on the 4-pin male header, is when you cannot keep the SS signal (SPI) on Digital pin 10 and need to move it to the default position, which is digital pin 53 on the MEGA. If this is the case, then download a different spi.h file named spiMEGAold.h, place the jumper in MEGA (2-3) position, and connect a wire from pin 4 on the Shield to digital pinn 53 on the MEGA:
6/22/2009 2:12 AM
NKC Electronics Tutorials
5 of 29
http://mcukits.com/
Posted in Freeduino/Arduino | 1 Comment »
STM32 Primer I/O header hack April 13th, 2009
The STM32 primer is an excellent tool to start playing with the Cortex-M3 based STM32 microcontrollers. The STM32 Primer features an STM3210B microcontroller (128 Kbytes Flash) USB connector, 128×128 color LCD, MEMS sensor, IrDA connector footprint, buzzer, LEDs and push button. It also has a solder footprint (2mm spaced) with some communication signals exposed. I created this weblog to document how this extension port can be used. It is located next to the rechargeable batteries:
I extracted the pinout from the schematics:
6/22/2009 2:12 AM
NKC Electronics Tutorials
6 of 29
http://mcukits.com/
and the pinout is as follows:
Some signals are already used by the included peripherals, like the accelerometer. Please, verify the complete schematics available here (You need to register to access the resources documents). You can solder some wires to the footprint pins or you can solder a 2mm pin header, male or female. I have the 2×12 2mm female header, so I used it to create a socket for this hack. The socket is a through-hole component, so I bended the pins outwards to solder it as an SMD socket. The socket can be purchased here
Posted in STM32 | No Comments »
Arduino Ethernet Shield MEGA hack April 6th, 2009
The Arduino MEGA was announced officially on March 26th, 2009. The MEGA kept the odd pin header spacing to make it compatible with most Arduino shields. But unfortunately, some pins had to be moved and this movement made some shields that use SPI incompatible. One of the most popular shields, the Arduino Ethernet shield is one of the incompatible shields, as it relies on SPI for Arduino to Ethernet communication. The good news is that it is possible to make it work with the MEGA and here is the procedure: Ingredients Arduino MEGA board Arduino Ethernet shield 4 x male2male jumper wires
6/22/2009 2:12 AM
NKC Electronics Tutorials
7 of 29
http://mcukits.com/
ingredients First the Hardware hack The SPI signals SCK, MISO, MOSI and SS are located in pins 13, 12, 11 and 10 on the Arduino Diecimila/Duemilanove or compatible boards like freeduino and seeeduino. These signals moved to pins 52, 50, 51 and 53 on the Arduino MEGA. Signals SCK, MISO and MOSI are available in the ICSP 2×3 pin header also, but signal SS is missing from this header, and only available on pin 53. As the Arduino Ethernet shield expects to get these signals from pins 13 to 10, we need to re-wire them to pins 50 to 53. First, we need to disconnect pins 13 to 10 in the Arduino Ethernet Shield:
these4pins Bend them slightly to the outside:
these4pinsside And plug the Arduino Ethernet shield to the Arduino MEGA, so these 4 pins remains unplugged:
plug
6/22/2009 2:12 AM
NKC Electronics Tutorials
8 of 29
http://mcukits.com/
Now, how are we going to get the SPI signals? From pins 50 to 53… following the next mapping: MEGA pin 50 (MISO) to Arduino Ethernet Shield pin 12. MEGA pin 51 (MOSI) to Arduino Ethernet Shield pin 11. MEGA pin 52 (SCK) to Arduino Ethernet Shield pin 13. MEGA pin 53 (SS) to Arduino Ethernet Shield pin 10.
wires1
wires2
wires3 Now the Hardware hack is complete, but there is one more change we need to do, as the original Ethernet Library included with the Arduino IDE has hardcoded the SPI signals. We need to change these hardcoded signals to match the new position in the Arduino MEGA. Software Hack Locate the file spi.h in the hardware/libraries/Ethernet/utility directory, under your Arduino 0015 installation. Find and replace the following 5 lines: #define ... #define ... #define ... #define ... #define
SPI0_SS_BIT BIT2 SPI0_SCLK_BIT BIT5 SPI0_MOSI_BIT BIT3 SPI0_MISO_BIT BIT4 IINCHIP_CS_BIT BIT2
and replace them with this code: #define ... #define ... #define ... #define ... #define
SPI0_SS_BIT BIT0 SPI0_SCLK_BIT BIT1 SPI0_MOSI_BIT BIT2 SPI0_MISO_BIT BIT3 IINCHIP_CS_BIT BIT0
6/22/2009 2:12 AM
NKC Electronics Tutorials
9 of 29
http://mcukits.com/
These 5 lines are in a non-consecutive order in the spi.h file. After you save the edited spi.h file, remove all .o files in the utility and Ethernet directory. Open the Arduino 0015 IDE (The Arduino MEGA requires Arduino 0015), and load your preferred Ethernet sketch or try this example that I use (You need to change the IP address to reflect the values in your network): #include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 192, 168, 1, 50 }; // Change this parameters to reflect your network values byte server[] = { 64, 233, 187, 99 }; // Google Client client(server, 80); void setup() { Ethernet.begin(mac, ip); Serial.begin(9600); delay(1000); Serial.println(”connecting…”); if (client.connect()) { Serial.println(”connected”); client.println(”GET /search?q=arduino HTTP/1.0″); client.println(); } else { Serial.println(”connection failed”); } } void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println(”disconnecting.”); client.stop(); for(;;) ; } } Compile and upload the sketch. Activate the Serial Monitor, set baud to 9600 and you should see the Google search result, in html format, like in the following screen capture:
ide And the complete hack while getting information from Google:
6/22/2009 2:12 AM
NKC Electronics Tutorials
10 of 29
http://mcukits.com/
working This concludes the Arduino Ethernet Shield MEGA hack. You can purchase the Arduino MEGA here and the Arduino Ethernet Shield here April 14th, 2009 UPDATE The previous hack requires moving 4 signals: SCK, MOSI, MISO and SS. As SS is used by AVR only when working SPI in SLAVE mode, I decided to try a new simpler hack, and move only 3 signals: SCK, MOSI and MISO, and use digital pin 10 as SS. This way, only 3 pins need to be bended: 13, 12 and 11. At the beginning this seemed to be a simple modification to the original hack, but mysteriously it didn’t work. Assigning SPI0_SS_BIT and IINCHIP_CS_BIT to BIT4 (corresponding to digital pin 10 on the Arduino MEGA), the Arduino Ethernet shield couldn’t be initialized, so the sketch didn’t work (It never returned from Ethernet.begin()). After doing some research, I found that the SS pin is also used when setting AVR in SPI master mode, but only before setting bit 4 of register SPCR (Master mode) required this pin SS to be HIGH. So I tricked some more code to make it work (force SS HIGH before setting bit 4 in SPCR register to HIGH). Hardware hack Follow hardware hack instructions above, but only bend pins 13, 12 and 11. Wire the pins as instructed, except for the 4th wire from Arduino MEGA pin 53 to Ethernet Shield pin 10 (as this pin is not bended in this new hack). Software hack Forget all the changes suggested above, and follow this new changes: Find and replace the following 6 lines: #define SPI0_SS_BIT BIT2 ... #define SPI0_SCLK_BIT BIT5 ... #define SPI0_MOSI_BIT BIT3 ... #define SPI0_MISO_BIT BIT4 ... #define IINCHIP_CS_BIT BIT2 ... PORTB |= SPI0_SS_BIT; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
and replace them with this code: #define SPI0_SS_BIT BIT4 ... #define SPI0_SCLK_BIT BIT1 ... #define SPI0_MOSI_BIT BIT2 ... #define SPI0_MISO_BIT BIT3 ... #define IINCHIP_CS_BIT BIT4 ... PORTB |= SPI0_SS_BIT | BIT0; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
By adding BIT0, we force pin SS to be HIGH when the SPCR register is set for AVR to behave like SPI master device. I hope you find the new addition simpler to execute than the original hack. Posted in Freeduino/Arduino | 4 Comments »
If there is an Arduino MEGA, then there should be a MEGAshield March 16th, 2009
Hi, I just saw the picture of the Arduino MEGA featured in hack-a-day If there is an Arduino MEGA, then for sure you need a MEGAshield. Here are some pictures of the NKC MEGAShield:
6/22/2009 2:12 AM
NKC Electronics Tutorials
11 of 29
http://mcukits.com/
6/22/2009 2:12 AM
NKC Electronics Tutorials
12 of 29
http://mcukits.com/
Half Stackable MEGAShield = Monster MEGAShield (As called by ladyada) I installed long legged 6-pin and 8-pin headers to make the Arduino MEGAshield stackable on the left half side (legacy Arduino side?). Here are some pictures:
6/22/2009 2:12 AM
NKC Electronics Tutorials
13 of 29
http://mcukits.com/
Posted in Freeduino/Arduino | 23 Comments »
Assembling the NKC Electronics XBee Shield V3.0 KIT
6/22/2009 2:12 AM
NKC Electronics Tutorials
14 of 29
http://mcukits.com/
March 12th, 2009
Assembling the NKC Electronics XBee Shield V3.0 KIT SCHEMATICS (click on images to enlarge)
The NKC Electronics XBee Shield V3.0 KIT is an enhanced version of the original Arduino XBee Shield. It is sold in a DIY kit format and it comes with all the components required to assemble a full XBee Shield that is pin-compatible with all Arduino format compliant boards (Arduino, Freeduino, Seeeduino, etc). First, unpack the kit
and start with the PCB. Let’s start with the power portion of the schematic using the following parts: IC1
TLV2217-33 Voltage Regulator (TO-220 package)
C1
100nF ceramic capacitor
C2, C3 10uF electrolytic capacitor
Next continue with the transistor, LEDs and other discrete components:
R1 R2
10K resistor 15K resistor
6/22/2009 2:12 AM
NKC Electronics Tutorials
15 of 29
R3, R4 R5 RSSI ASSOCIATE T1 reset
http://mcukits.com/
1K resistor 330ohm resistor 3mm LED 3mm LED blue (transparent) BC547 transistor tactile switch
Solder the sockets and pin headers:
Next step: Insert the jumpers:
There are 4 jumpers. J1 and J2 are for upgrading the firmware on the XBee module. Leave open for normal operation (both J1 and J2 open).
Pay special attention to the alignment of the female headers. The 2×3 female socket must be placed with the female portion facing down. This board takes some signals from the ICSP connector, so this socket is mandatory. And this is the final picture of the XBee Shield V3.0 assembled and ready to use. XBee module is not included in the kit and must be purchased separately.
http://www.nkcelectronics.com/ Posted in Freeduino/Arduino | No Comments »
atxmega128a1 DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc - 0.6V March 12th, 2009
I started experimenting with the new ATMEL atxmega128a1 chip, when I noticed a strange noise in the signal generated by the DAC example (atmel application note AVR1301: Using the XMEGA DAC). I captured the signal with a Rigol VS5042 Digital Storage Oscilloscope:
6/22/2009 2:12 AM
NKC Electronics Tutorials
16 of 29
http://mcukits.com/
You can clearly see the noise at the bottom of the sawtooth signal. The setup: STK600 (Target Voltage 3.6V) TQFP100 Package ATMEGA128A1 AVR Studio 4.15 WINAVR 20080610 Rigol VS5042 Digital Storage Oscilloscope AVR1301 example in C I thought there was a mistake in the example program, and was about to review it, when I found the following note in the Errata section of the atmega128a1 preliminary datasheet: “DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc - 0.6V” So I went back to AVR Studio and set the target voltage of the STK500 (and the target device) to 2.0V, and the problem does not appear:
I assume the VREF used by the example program is internal, so lowering the voltage of the target device is the setup that fixes the problem. I will change the example program to use external VREF and see if it is possible to power the target with 3.3V and lower VREF to 2.0V and see if the problem can be fixed as well. The ATMEL documentation says that there is no workaround to this problem, and they recommend using VREF below 2.4V or Vcc - 0.6V The XMEGA is a very advanced and interesting device. The only disadvantage is that it is very difficult to get good documentation, user experiences, etc. So I will be preparing different settings and publishing the results. Update: I checked the source code and VREF was set to AVCC, and AVCC = Target Voltage. That is why the only way to change VREF to 2.0V was to lower the complete target board (STK600) voltage to 2.0V. I modified the source code to use external VREF for DAC channel A, and the result is that I can set the target board voltage to 3.5V and VREF to 2.0V and now the example works ok, without noise in the SAWTOOTH signal.
DSO channel 1 (yellow) is the sawtooth signal output, with Vmax = 2.0V and channel 2 (blue) is VTarget, with Vmax = 3.5V. Posted in XMEGA | No Comments »
Assembling the NKC Electronics JTAG ICE Clone Board (Rev. B) March 12th, 2009
Assembling the NKC Electronics JTAG ICE CLONE Board (Rev. B) by NKC Electronics SCHEMATICS (right click –> view image)
6/22/2009 2:12 AM
NKC Electronics Tutorials
17 of 29
http://mcukits.com/
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. This guide covers the assembly process of the JTAG ICE clone Rev B kit (marked Rev B in the PCB) 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.
We will install the passive components (resistors, capacitors, etc) first.
Start by soldering the resistors R1 to R7, C3 to C9 ceramic capacitors, C10 electrolytic capacitor and D2 diode R1 R2, R3, R4, R6 R5, R7 C3, C4, C5, C6, C7, C8, C9 D1 C10
10 K resistor 1 K resistor 4.7 K resistor 0.1uF ceramic capacitor 1N4148 diode 10uF electrolytic capacitor
Next identify and separate the 2 22pF ceramic capacitors, 2 LEDs and the crystal C1, C2 Q1 PWR, JTAG
22pF ceramic capacitor 7.3728 crystal 3mm LED
6/22/2009 2:12 AM
NKC Electronics Tutorials
18 of 29
http://mcukits.com/
Now separate the 16-pin IC socket, 40-pin IC socket (wide), 10-pin male header, 5-pin male header, DB9 female PCB connector. Cut the 5-pin male header in one 3-pin header and one 2-pin header. X1 JTAG IC1 IC2 JP1 JP2
DB9 female PCB connector 2×5 male header 40-pin DIP socket 16-pin DIP socket 3-pin male header 2-pin male header
We are done with the soldering. You need to install the MCU and the RS232 (ICL3232, MAX3232, ST3232) 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.
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)
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.
6/22/2009 2:12 AM
NKC Electronics Tutorials
19 of 29
http://mcukits.com/
This is how the JTAG ICE clone board looks ready to use with the 10-wire cable for the target board.
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 (Use the provided JP2 and jumper to supply power to the board from the target device). 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. 2. 3. 4.
Start AVR Studio Verify mode jumper is in 2-3 Normal 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 Both LEDs are on
5. Select Connect to the Selected AVR Programmer
6. You should see the following message: 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:
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
6/22/2009 2:12 AM
NKC Electronics Tutorials
20 of 29
http://mcukits.com/
Posted in AVR | No Comments »
Assembling the Freeduino Serial v2.0 Board (MAX232) March 12th, 2009
Assembling the ArduinoTM Diecimila Compatible Freeduino Serial v2.0 Board SCHEMATICS (click on images to enlarge)
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. The v2.0 board uses a MAX232 compatible chip for interfacing with RS232. The older v1.0 board used two transistors, but had some reliability issues with auto-reset and sketch uploading. First, unpack the kit
and start with the PCB. Let’s start with the power portion of the schematic using the following parts: DC1 D1 C5 C6, C7 IC2 Power LED R2
DC power jack 1N4004 diode 100nF ceramic capacitor 47uF electrolytic capacitor 7805 5V positive voltage regulator 3mm LED 330 ohm resistor
Plug a wall plug voltage regulator (+7V to +12V). The LED lights up, indicating that the Power supply is working. NOTE: This board is shields friendly as the 7805 voltage regulator is mounted horizontally. Next continue with the soldering of the RS232 components:
6/22/2009 2:12 AM
NKC Electronics Tutorials
21 of 29
X1 IC3 C4, C8, C9, C10, C11, C12
http://mcukits.com/
DB9 female PCB adapter 16-pin IC socket 0.1uF (100nF) ceramic capacitors
Solder the rest of the components:
R3 R4, R6 R5 C2, C3 C1 13 Q1 RESET IC1 ICSP
1.5Kohm resistor 1 Kohm resistor 10 Kohm resistor 22pF ceramic capacitor 0.1uF (100nF) ceramic capacitor 3mm LED (Arduino pin 13 status LED) 16 MHz crystal Reset switch 28-pin IC socket 2×3 pin male header
Now solder the headers and sockets: POWER & Analog In Digital
6-pin female header 2 x 8-pin female header
Pay special attention to the alignment of the female headers.
And finally install the ATMEGA168 MCU and the MAX232 (or HIN232 / ICL232) chips.
6/22/2009 2:12 AM
NKC Electronics Tutorials
22 of 29
http://mcukits.com/
The board is ready to be used. Start the Arduino IDE 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). The board has space for an optional 3.3V regulator (78L33 TO-92 footprint) with it’s associated decoupling 0.1uF capacitor (C13).
http://www.nkcelectronics.com/arduino.html Posted in Freeduino/Arduino | No Comments »
Assembling the Freeduino (Arduino) Motor Shield March 12th, 2009
Assembling the ArduinoTM Freeduino Motor Shield SCHEMATICS (click on images to enlarge)
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. First, unpack the 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
6/22/2009 2:12 AM
NKC Electronics Tutorials
23 of 29
IC Socket 2
http://mcukits.com/
16-pin IC socket
Then, we can solder the resistors and the LED. PWR R7 R3, R4, R5, R6
3mm LED 1K resistor 100K resistor
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 R3 to R6 resistors.
We continue with the capacitors: C4, C9 C10, C11, C12, C13
100uF electrolytic capacitor 100nF ceramic capacitor
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.
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.
6/22/2009 2:12 AM
NKC Electronics Tutorials
24 of 29
http://mcukits.com/
The motor shield, completely assembled and ready to use.
You can connect two DC motors. One goes on the first 2 socket holes (MOTOR B), from the top.
The second motor (MOTOR A)goes on the 2 bottom socket holes.
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 /
6/22/2009 2:12 AM
NKC Electronics Tutorials
25 of 29
http://mcukits.com/
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 Posted in Freeduino/Arduino | No Comments »
Assembling the Freeduino Serial v1.0 Board March 12th, 2009
Assembling the ArduinoTM Diecimila Compatible Freeduino Serial v1.0 Board SCHEMATICS (click on images to enlarge)
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
and start with the PCB. Let’s start with the power portion of the schematic using the following parts: DC1 D1 C5 C6, C7 IC2 Power LED R2
DC power jack 1N4004 diode 100nF ceramic capacitor 47uF electrolytic capacitor 7805 5V positive voltage regulator 3mm LED 330 ohm resistor
Plug a wall plug voltage regulator (+7V to +12V). The LED lights up, indicating that the Power supply is working.
6/22/2009 2:12 AM
NKC Electronics Tutorials
26 of 29
http://mcukits.com/
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:
The result is shown with the XBee shield, Motor controller shield and NKC Electronics protoshield.
Next continue with the soldering of the RS232 components:
6/22/2009 2:12 AM
NKC Electronics Tutorials
27 of 29
X1 T1 T2 D2, D3 C8 R1 R3 R4
http://mcukits.com/
DB9 female PCB adapter BC547 BC557 1N4148 10uF electrolytic capacitor 4.7K resistor 1.5K resistor 1K resistor
Solder the rest of the capacitors and resistors: R5-R9 C2, C3 C1, C4
10 Kohm resistor 22pF ceramic capacitor 100nF ceramic capacitor
Now solder the crystal, switch and the 13-pin LED:
S1
reset switch
13
3mm LED
Q1
16MHz crystal
Now solder the headers and sockets: ICSP POWER Analog In Digital IC1
2×3 pin male header 4-pin female header 6-pin female header 2 x 8-pin female header 28-pin DIP socket
6/22/2009 2:12 AM
NKC Electronics Tutorials
28 of 29
http://mcukits.com/
Pay special attention to the alignment of the female headers.
And finally install the ATMEGA168 MCU.
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 Posted in Freeduino/Arduino | No Comments » « Older Entries Search for:
Pages About
Archives April 2009 March 2009
Categories AVR (2) Freeduino/Arduino (9) Oscilloscopes (1) STM32 (1) Uncategorized (1) XMEGA (1)
Blogroll Development Blog Documentation Plugins Suggest Ideas Support Forum Themes WordPress Planet
6/22/2009 2:12 AM
NKC Electronics Tutorials
29 of 29
http://mcukits.com/
Meta Log in Valid XHTML XFN WordPress NKC Electronics Tutorials is proudly powered by WordPress Entries (RSS) and Comments (RSS).
6/22/2009 2:12 AM