Archive for the ‘Dorkbot’ Category

Focused workshop: Artbots 30 May 10 — PNCA ($35)

Saturday, May 22nd, 2010


In this workshop we will be taking our dorkboards and using them to create a simple machine that draws. The focus will be on hands on problem solving.

What you will get.

  • A servo and a geared motor with paper feed.
  • A motor driver board.
  • Misc parts.

What to bring:

  • A dorkboard, teensy or other arduino capable board.
  • A soldering iron.
  • Some basic tools (esp wire cutters, x-acto knife)
  • superglue
  • A hot glue gun.
  • foamcore or cardboard.
  • $35 or a copy of your rsvp / paypal reciept.

Where:

PNCA — 1432 NW Johnson St, Room 205

When:
Sunday May 30nd from 1 to 5pm

How do I rsvp?

Running Paul Stoffregons’s teensy_serial arduino core on DFU based chips.

Tuesday, April 20th, 2010
das blinkin

das blinkin

With a lot of my projects I have done my prototyping with Paul Stoffregon’s Teensy series of boards before moving them onto their own codebases. On those occasions where the “prototype was all I needed” I would compile the code using the teensyduino and then manually load the .hex file onto the target. As I am looking at using the arduino for more projects I decided to take a look at how paul interacts with the Arduino IDE and see if I could load code directly onto my chips.

boards.txt

The arduino allows for different chips and configurations through the boards.txt and the programmers.txt files. Each configuration usually will also have a “core” which maps the pins and handles the particulars of that chip. When you run paul’s teensyduino installer it adds several entrys to the boards.txt file including the entry below.

teensy_ser.name=Teensy 1.0 (USB Serial)
teensy_ser.upload.protocol=halfkay
teensy_ser.upload.maximum_size=15872
teensy_ser.upload.speed=38400
teensy_ser.upload.disable_flushing=true
teensy_ser.upload.avrdude_wrapper=teensy_reboot
teensy_ser.build.mcu=at90usb162
teensy_ser.build.f_cpu=16000000L
teensy_ser.build.core=teensy_serial
teensy_ser.build.post_compile_script=teensy_post_compile
teensy_ser.name=Teensy 1.0 (USB Serial) teensy_ser.upload.protocol=halfkay teensy_ser.upload.maximum_size=15872 teensy_ser.upload.speed=38400 teensy_ser.upload.disable_flushing=true teensy_ser.upload.avrdude_wrapper=teensy_reboot teensy_ser.build.mcu=at90usb162 teensy_ser.build.f_cpu=16000000L teensy_ser.build.core=teensy_serial ...
Looking at pauls additions to the boards.txt I see that he is using the teensy_serial core  that he has written to create a simple usb to serial interface and to map the usb avr pins and other peripherals to the arduino conventions. He is also adds an entry to the arduino uploader class which lets him use a wrapper for avrdude which lets him use his proprietary bootloader. This wrapper is installed by the Paul’s installer and  lives in the Arduino’s bin directory. After looking to see if this wrapper was a script I replaced the entry in the boards.txt and put a script into the bin directory called “dfume”, after seeing that my replacement wrapper worked I added two new entries for each class of avr that I wanted to use the atmega32u2 and the atmega32u4
#############################################################
fouryou.name = atMega32U4
fouryou.upload.protocol=atmega32u4
fouryou.upload.maximum_size=32256
fouryou.upload.speed=38400
fouryou.upload.disable_flushing=true
fouryou.upload.avrdude_wrapper=dfume
fouryou.build.mcu=atmega32u4
fouryou.build.f_cpu=16000000L
fouryou.build.core=teensy_serial
#############################################################
tooyou.name = atMega32u2
tooyou.upload.protocol=atmega32u2
tooyou.upload.maximum_size=32256
tooyou.upload.speed=38400
tooyou.upload.disable_flushing=true
tooyou.upload.avrdude_wrapper=dfume
tooyou.build.mcu=at90usb162
tooyou.build.f_cpu=16000000L
tooyou.build.core=teensy_serial
############################################################# fouryou.name = atMega32U4 fouryou.upload.protocol=atmega32u4 fouryou.upload.maximum_size=32256 fouryou.upload.speed=38400 fouryou.upload.disable_flushing=true fouryou.upload.avrdude_wrapper=dfume fouryou.build.mcu=atmega32u4 fouryou.build.f_cpu=16000000L fouryou.build.core=teensy_serial ############################################################# tooyou.name = atMega32u2 tooyou.upload.protocol=atmega32u2 tooyou.upload.maximum_size=32256 tooyou.upload.speed=38400 tooyou.upload.disable_flushing=true tooyou.upload.avrdude_wrapper=dfume tooyou.build.mcu=at90usb162 tooyou.build.f_cpu=16000000L tooyou.build.core=teensy_serial

I started with a blank script that just printed the arguments passed to the wrapper and then called it by restarting my Arduino (to reload the boards.txt) And then selecting one of the new boards and “Uploading” my code. This gave me a window to interactively work through my script. Since the avrdude_wrapper code just pretends to be an avrdude most of the script is munging the arguments passed to avrdude to get the commands to pass to dfu-programmer.

#!/usr/bin/perl
use Getopt::Std;
print @ARGV;
my %args;
my $hexfile;
my $dfu = "/usr/local/bin/dfu-programmer";
my $cpu;
my $hexfile;

getopt('pUc',\%args);
$hexfile=$args{U};
$hexfile =~ s/flash:w://;
$hexfile =~ s/:i//;
$cpu=$args{c};

print "\n[" . $hexfile . "]";
print "\n[" . $cpu . "]\n";
print "$dfu $cpu erase\n";
system "$dfu $cpu erase";
print "$dfu $cpu flash $hexfile\n";
system"$dfu $cpu flash $hexfile";
print "$dfu $cpu start\n";
system "$dfu $cpu start 1>&2";
print "\n";

There is one tricky bit. The current avr-gcc doesnt support the atmega32u2 correctly but the code for the at90usb162 is binary compatible so the build.mcu is set to the at90usb162. But then dfu-programmer supports the correct chip and wont find the device so we use the fact that the upload.protocol argument is passed directlyalong using the -c argument and everything works fine.

So now we just use the hwb and reset buttons to get the system into dfu mode and upload our code directly from the arduino. Its not as slick as the teensy in “auto” mode but it works.

Focused Workshop: Programming the Midi Monster (28FEB10 PNCA).

Tuesday, February 23rd, 2010

What: Focused workshop: programming Midi devices using the Lightweight Usb For AVR library (Lufa) and the MidiMonster.

When: Sunday 28 Feb 2010 1-5 pm.

Where: PNCA (NW 12th and Johnson) #205

Cost: $35 (includes Midi Monster)
(If you have a MidiMonster from the PD Workshop and wish to use it please bring $10)

Materials: you Should Bring, a laptop and a mini usb cable. Please install Arduino >16 as well.

In this workshop we will be going through the firmware built by Alex Norman as an example of how to develop midi devices using the avr microcontoller. Topics covered will include:

  • The Midi Specification
  • The USB Midi Specification
  • The Lightweight Usb for AVR  library.
  • Programming the avr using avr-gcc

To reserve a place in the class please rsvp at http://tempusdictum.com/tdproducts.html

My Sample Design for Fabrication Workshop.

Tuesday, December 1st, 2009

At the eagle for fabrication workshop on sunday I started with a design that Thomas Lockney threatened to build about 2 years ago called the Low Fi Arduino Guitar Pedal.

(http://www.instructables.com/id/Lo_fi_Arduino_Guitar_Pedal/)

It was simple enough to get through the necessary parts of eagle that I was teaching and while it wasn’t perfect It beat the hell out of Craig Anderton’s circuits in terms of clarity and probability of actually working. To discuss from an over view perspective creating parts I decided to add the 1/4″ jacks from another great dorkbotpdx project from Hans Lindauer.

Once I got the library part together for the 1/4″ jack I had to rearrange things quite a bit but there was still pleanty of room. The next step was to add a power connector and a regulator. The idea is to be able to mount the resulting board in one of the cheapo danelectro pedels that I have around like this

In order to get the board to work out I had to create a new package for the potentiometers but I managed to get it all to fit on the board without resorting to surface mount components.

I will post the library example latere this evening.

circuit design for fabrication

Thursday, November 12th, 2009

Workshop: circuit design for fabrication (PNCA 29Nov09 1-5pm $35)

See: http://www.dorkbotpdx.org/workshop/circuit_design_for_fabrication

boardfancy

As many of you may be aware Laen has been putting together a group ordering process for circuit board fabrications somewhat like SparkFun’s BatchPCB service except with less time lag and the fabrication is done in the USA.

To introduce you to the tools needed to create circuit boards for this service (and most other circuit board services) we are presenting a workshop teaching you how to design a circuit board using Eagle PCB with an emphasis on getting designs that can be fabricated.

Workshop Time and Location

The workshop will be offered on two dates (Pick one):
* November 29th at PNCA (NW 12th and Johnson, room 205) (Google Calendar Link)
* December 5th through OpenTechSpace at Techshop (10100 SW Allen Blvd., Beaverton, OR 97005) (Google Calendar Link)

Follow-up Session:

A follow-up session will be offered on December 6th, 1pm-5pm at PNCA , to go over your designs, help with any problems, and getting them ready for submission for fabrication.

Fabrication included

Signing up for the class gets you three copies of your (up to 2 square inch) design in the December order. Designs submitted by the 10th of December will be included in this months PCB run and can be picked up at the meeting on the 21st (or mailed).

Topics covered.

  • Creating schematics
  • Organizing your files and libraries.
  • Laying out your parts effectively.
  • Routing your signals
  • Creating / finding parts that you need.
  • Documenting your board in the silkscreen
  • Using DRUs to design for a specific board fabricator
  • Using the ERC to check your designs for problems

What you will need

You should have some basic understanding of circuits but it is not critical You will need to bring a laptop which is capable of running eagle (linux,windows or mac — see http://www.cadsoft.de/info.htm). The class is $35 and is limited to 30 so it is best to reserve a space in the class. Please rsvp at http://tempusdictum.com/tdproducts.html (eagle for fabrication)

Scary George. (driving a floppy drive stepper with the Arduino/Wiring platform)

Tuesday, October 27th, 2009

I wanted to quickly demonstrate using a stepper motor from a floppy drive with the Arduino/Wiring platform as a follow up to the weekend’s workshop. By the time we got to the stepper parts I was a bit scattered. So here is an example that I set up yesterday.

I have a talking George Bush doll from several years ago that was ripped in half (by people watching my punk band (w.busholini.org)) so I went ahead and finished dismantling it. For Halloween I thought his head should turn around Linda Blair style.

I wired up a ULN2803 Darlington array and a floppy drive stepper motor from the workshop as shown in the diagram above .

I figured out which wire was the common wire by taking an ohmmeter to the wires on the stepper. Most of the combinations were about 150 except from one of the wires on the end that read 75 ohms. Checking the 75 against all of the other wires I was able to determine that one of the wires was the common one and marked it with a sharpie.

Then I ran up the arduino (v 17) example program for the stepper library. I modified it so that it just made steps in one direction. When I ran it the motion was really jittery so I checked to make sure that my wiring was good and then rather than rewiring the stepper physically I changed the line in the code from

Stepper stepper(STEPS, 9, 10, 11, 12);

to

Stepper stepper(STEPS, 9, 11, 10,12);

And Whah La! his head started spinning just like he was possessed by Dick Cheney! I wired the talk button to pin 8 and then added some random delays which gave me the following.

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100
int relayPin=8;
int ledPin=13;
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 9, 11, 10,12);

// the previous reading from the analog input
int previous = 0;

void setup()
{ pinMode(relayPin,OUTPUT);
  pinMode(ledPin,OUTPUT);
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(100);
}

void loop()
{
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  //stepper.step(val - previous);
digitalWrite(ledPin, HIGH);
stepper.step(random(5,90));
delay(random(60,2000));
digitalWrite(relayPin, HIGH);
delay(20);
digitalWrite(relayPin, LOW);
digitalWrite(ledPin, LOW);
stepper.step(-random(15,200));
delay(random(90,3000));
  // remember the previous value of the sensor
  previous = val;
}

Motors and Servos and Solenoids, OH MY (rev2).

Monday, October 19th, 2009


On Sunday the 25th I am going to do an animtronicx workshop covering driving
motors, servos and relays with the arduino/wiring platform.
I will be covering the a couple of popular chips: The l293D for
driving motors , and the ULN2803 darlington array for driving relays,
stepper motors and other devices.
The workshop will cost $35 and will include these chips, a motor, a standard sized servo and a board for the motor driver.

The idea is to get as much hands on and working as possible so please
bring your arduino,freeduino,teensy,or dorkboard, a soldering iron, some wire and your
laptop and we will get our hands dirty.
I am limited to 25 on this one so please RSVP as soon as possible.

http://tempusdictum.com/tdproducts.html

This will be in room 205 at PNCA (NW 12th and Johnson) from 1-5 pm.

Arduino Cult Induction, Techshop Session. 11 October 2009

Tuesday, October 6th, 2009

http://opentechspace.org/2009/09/21/arduino-cult-induction-workshop-1-5pm-oct-11/

5 lines about 36 Blinking Lights.

Wednesday, September 16th, 2009

A while back I started thinking about a way to display stationary bike race results that didn’t require either a projector or a really complicated mechanical assembly. The thing that came to mind was a race tree like at the drag races. I asked Amanda who has been running bike events in portland if she could get me 12 lights. I wound up with pile of Bike Planet lights which required about a weeks worth of surgery.

From one of our led driving discussions a few years back I wound up with a tube of 74hc595s which I wired up like so.

While there are examples using bit banging to drive shift registers with the arduino they ignore the built in hardware capabilities of the AVR family.

Using the built in spi greatly simplifies your code and is remarkably fast. In the code sample below there are 5 bytes which represent the 40 pins from 5 shift registers. The main loop just toggles the bits and sends them out the door.

byte outbytes[5]={0x55,0x55,0x55,0x55,0x55};
//uncomment this for a standard arduino
//#define PIN_SCK          13             // SPI clock (also Arduino LED!)
//#define PIN_MISO         12             // SPI data input
//#define PIN_MOSI         11             // SPI data output#define PIN_HEARTBEAT     7           // added LED
#define PIN_SCK          9           // SPI clock (also Arduino LED!)
#define PIN_MISO         11            // SPI data input
#define PIN_MOSI         10          // SPI data output
#define PIN_SS         8             // SPI slave select

void EnableSPI(void) {
SPCR |= 1 << SPE;
}

void DisableSPI(void) {
SPCR &= ~(1 << SPE);
}

byte SendRecSPI(byte Dbyte) {             // send one byte, get another in exchange
SPDR = Dbyte;
while (! (SPSR & (1 << SPIF))) {
continue;
}
return SPDR;                             // SPIF will be cleared
}

void RunShiftRegister(void) {
byte bitBucket;
int i;
digitalWrite(PIN_SS,HIGH);
EnableSPI();                             // turn on the SPI hardware
for (i=0; i<5; i++) {
bitBucket = SendRecSPI(outbytes[i]);
}
DisableSPI();                             // return to manual control
digitalWrite(PIN_SS,LOW);

}

void setup() {

pinMode(PIN_SCK,OUTPUT);
digitalWrite(PIN_SCK,LOW);
pinMode(PIN_SS,OUTPUT);
digitalWrite(PIN_SS,HIGH);
pinMode(PIN_MOSI,OUTPUT);
digitalWrite(PIN_MOSI,LOW);
pinMode(PIN_MISO,INPUT);
digitalWrite(PIN_MISO,HIGH);

SPCR = B01110001;              // Auto SPI: no int, enable, LSB first, master, + edge, leading, f/16
SPSR = B00000000;              // not double data rate

}

void loop(){
int i;
RunShiftRegister();
for (i=0; i<5; i++){
outbytes[i]= ~outbytes[i];
}
delay(1000);
};

Simple fast and easy.

Arduino Cult Induction 30 August 1-5 pm

Tuesday, August 25th, 2009



http://dorkbotpdx.org/workshop/arduino/cult_induction_rev7