Announcing: KiCad workshop at Nova Labs

Hey!  Great news.  Its time to take that project from breadboard to printed circuit board.  Anool (WyoLum co-founder and master designer) will be leading a workshop on KiCad in Northern VA at NOVA Labs September 13-15, 2013.  Sign ups now available.  Limited to first 15 students.

The goal of the weekend is for each student to complete a design, ready for submittal to a fabricator like OSHPark.

 

Project ideas:

  • Custom Arduino compatible board
  • An Arduino shield
  • Motor controller
  • Clock (our favorite)
  • Custom NeoPixel board

We came up with this project while brain storming ways to offset the travel expenses for Anool’s to attend the Open Hardware Summit.  This seems like the best way to expand the Open Hardware movement and attain our funding goals.

You will learn how to take a project …

from a sketch

 

to schematic

to layout

to 3D view

to real life

 

 

Programming ClockTHREEjr_v2

At some point, you may wish to re-program your ClockTHREEjr_v2 or maybe you are building a clock from scratch.  This post will walk you through the steps.

Outline:

  1. Download and install Arduino for your target platform.  (More details can be found here.)
    • Navigate to the Arduino download site: http://arduino.cc/en/Main/Software
    • Download Arduino for your platform.
    • Unzip the file to the directory of your choice.  (We will refer to whatever directory you choose as <arduino_dir>).  I use c:\arduino\ on Windows or /home/justin/arduino/ on Linux so that (for arduino 1.0 for instance) the path extracted executable is c:\arduino\arduino-1.0\arduino.exe on Windows or /home/justin/arduino/arduino-1.0/arduino on Linux.
  2. Download and install ClockTHREE source code
    • Download the latest ClockTHREE library source code file from here: http://code.google.com/p/clockthree/downloads/list
    • Unzip the library source code file in your home directory. I use “My Documents\sketechbook\” on windows and /home/justin/sketchbook/ on linux.  We will refer to the directory you choose as <sketchbook>.
  3. IMPORTANT: Point Arduino to your newly extracted library files.
    • Start arduino (look here if you have trouble with this step)
    • Click File->Preferences to pull up the preferences menu.
    • Leave “Use external editor” unchecked if you plan on using Arduino as your editor.
    • Click the “Browse” button and navigate to your <sketchbook> directory from step 2.
    • Click “OK”.
    • Close and restart Arduino
    • Click “File->Sketchbook->libraries”.  If “ClockTHREE” is listed you’ve done well.
  4. Using a text editor, edit source code:
    • On or about line 32 of <sketchbook>/libraries/ClockTHREE/examples/ClockTHREE_04/ClockTHREE_04.ino, comment out all but one of the following lines depending on language and hardware.
    // #include "dutch_v1.h"
    // #include "english_v0.h"
    // #include "english_v2.h"
    #include "english_v3.h"
    // #include "french_v1.h"
    // #include "german_v1.h"
    // #include "german_v3.h"
    // #include "german_v5.h"
    // #include "hebrew_v1.h"
  5. Compile and upload
    • Connect the FTDI cable to ClockTHREE (mind color labels) and to your computer.
    • Click Tools->Boards->Duemilanove
    • Select USB port Tools->Serial Port (this may take some trial and error if you have several devices connected).
    • Compile and upload <sketchbook>/libraries/ClockTHREE/examples/ClockTHREE_04/ClockTHREE_04.ino.
      Click the arrow button, second from the right.  
  6. Congratulations!  That is it.  Now you can customize the code to your hearts content!

p.u.l.s.e. – fader control for Motorcycle parking Lamp

My brother is a Mechanical Engineer who loves his KTM Duke 200 bike. He asked me to build this circuit : http://sunbizhosting.co.uk/~spiral/blog/?p=227 for a ‘heartbeat’ lamp controller for the parking light. A Neutral Detect (ND) signal controls the lamp pulsing. When ND is HIGH, the Lamp is fully lit. When ND goes LOW, the lamp starts pulsing.

I’m not familiar with PIC microcontrollers, and didn’t want to dabble in “C” code. I’d be comfortable with an Arduino, but even the smallest ATMega seemed too big (and overkill) for this simple requirement. How about an ATTiny ? A bit of Googling, and I found this excellent resource for running the Arduino environment on the ATTiny : http://hlt.media.mit.edu/?p=1695

Time to churn out a circuit. I selected the ATTiny45 which has 6 I/O pins, with two of them being PWM, and three Analog. The schematic and board layout (in KiCad) can be found on the wyolum code repository at Google Code. The idea was to have a board that plugs in to the existing lamp socket. The board size is about the same as a T10 lamp. A new socket is wired to the p.u.l.s.e. board which then attaches to the lamp. A third wire from the p.u.l.s.e board goes to the Neutral Detect (ND) signal in the bike. This makes the installation clean and simple.

3D render of the p.u.l.s.e. board

3D render of the p.u.l.s.e. board

3D render of the p.u.l.s.e. board

The 6 way header is ICSP for programming the ATTiny.

p.u.l.s.e boards

p.u.l.s.e. boards

p.u.l.s.e. boards

Assembled p.u.l.s.e board

Assembled p.u.l.s.e board

Assembled p.u.l.s.e board

Green wire is for ND signal. Red and Black go to a Lamp socket. The p.u.l.s.e board plugs in to the original lamp socket.

Now for the Important bits – getting Arduino to run on the ATTiny. These are the steps :

PHASE I – Get the ATTiny boards.txt files
1. Download ATtiny hardware description files for the Arduino environment from here : https://github.com/damellis/attiny/zipball/Arduino1
2. Create a sub-folder called “

hardware

” in the Arduino sketchbook folder (find its location from preferences dialog in Arduino IDE)
3. Copy attiny folder from inside the downloaded .zip to the hardware folder. You should end up with folder structure like

Documents > Arduino > hardware > attiny

that contains the file boards.txt and another folder called variants.
4. Restart the Arduino IDE.
5. You should see ATtiny entries in the

TOOLS > BOARD

menu.

PHASE II – Hook up the ATTiny to the Programmer (Arduino Duemilenove)
6. I used an Arduino Duemilenove board as the Programmer. There are other options (see the original post).
7. Plug the ATTiny in to a prototyping board, and link up wires between the Arduino and the ATTiny as follows :

ATTiny <-> Arduino
Pin 1, RESET <-> Digital Pin 10, SS
Pin 2, NC <-> x
Pin 3, NC <-> x
Pin 4, GND <-> GND
Pin 5, MOSI <-> Digital Pin 11, MOSI
Pin 6, MISO <-> Digital Pin 12, MISO
Pin 7, SCK <-> Digital Pin 13, SCK
Pin 8, VCC <-> 5V

8. Load

ArduinoISP

sketch in to the Arduino IDE. This sketch can be found under the examples menu.
9. For ARDUINO 1.0, find the line in the

heartbeat() function

which says

“delay(40);”

and change it to

“delay(20)

.
10. Download this modified ArduinoISP sketch to the Arduino Duemilenove board.
11. Connect a 10uF, 16V electrolytic capacitor on the Arduino Board, between the RESET and GND pins. [+] of cap. goes to RESET and [-] of cap. goes to GND.

PHASE III – Change Fuses on ATtiny and burn Arduino Bootloader
12. ATtiny runs at 1MHz by default, out of the box. To make it compatible with Arduino IDE, it needs to run at 8MHz.
13. Select the 8MHz option for your selected ATtiny chip (“ATtiny45, internal 8MHz” in my case) from the

TOOLS > BOARD

Menu.
14. Select

TOOLS > PROGRAMMER > Arduino as ISP

15. Select

TOOLS > BURN BOOTLOADER

16. That’s it – done. You can now load Arduino sketches in to the ATtiny, using the same connections that you have already set up.
17. For the ATtiny45, the Port definitions are as follows :

ATtiny45 Pin No <-> Arduino Pin No
Pin 1, <-> PB5
Pin 2, <-> Pin 3, Analog Input 3 (PB3)
Pin 3, <-> Pin 2, Analog Input 2 (PB2)
Pin 4, <-> GND
Pin 5, <-> Pin 0, PWM (PB0)
Pin 6, <-> Pin 1, PWM (PB1)
Pin 7, <-> Pin 2, Analog Input 1 (PB2)
Pin 8, <-> VCC

For the other ATtiny chips, the table will be different. Check the ATtiny datasheet for details.

18. After Bootloader is burnt to the ATtiny, you can load the BLINK sketch to verify if it all works well. Change Pin 13 to Pin 0 before uploading the sketch, and you should get the blinking LED between PB 0 and GND of ATtiny (Pins 5 and 4)

Connections between Duemilenove Board and p.u.l.s.e for burning bootloader and downloading sketches (note the 10uF capacitor between RESET and GND of Duemilenove)

Connections - Duemilenove to ATtiny

Connections – Duemilenove to ATtiny

EDIT :
Video of p.u.l.s.e

Another video after installation in the Bike

Raspberry Pi, à la mode?

Lot’s of people are excited about the Raspberry Pi, a complete computer for $25 (or $35 with ethernet).
The initial shipment is entirely sold out, and there are 200,000 more on order. Lots of people have been saying that this is the end of the Arduino, as it’s about the same cost, but is a full linux system with keyboard, mouse, and hdmi video output.

We think this is an oversimplification. Arduino is fantastic at interfacing to the physical world in a way that no linux (or Windows) PC could hope to approach at any cost.

The Pi does have a GPIO connector, but it pales in comparison to the humble Arduino. No built in PWM (servos anyone?) and no Analog to digital conversion.

We consider both platforms complementary to one and other, like pie and ice cream.  Of course we call the result “Raspberry Pi à la mode”, the Linux side handels all of the displays, human interfaces, and number crunching.  The low power Arduino compatible “à la mode” board handles sensors, motors, and provides a highly accurate real time clock.

“À la mode” is an Arduino clone specifically designed to interface with  the Raspberry Pi. You can of course connect a standard Arduino to a Pi USB port using a cord, but when you want a turnkey solution, how about an Arduino compatible “plate” (what the Pi folks call shields) that fits right on top of the Raspberry Pi with direct access to GPIO port?


You can plug your existing Arduino shields right in,  and you can even run the Arduino IDE on the Pi. Since the Pi’s core mission is to provide equal access to computing to all children, this will also give the kids the opportunity to mix it up “Arduino-style” with real world hardware.

We couldn’t have a vanilla add-on, so we added:

  • A battery backed real time clock: RTC: DS3231 (same as ChronoDot)
  • uSD card for logging
  • Socketed Atmel Atmega 328p in case you make a wiring mistake and need to replace it.

We’re sending off for prototype boards soon, so if you have feedback, let us know!