The Digispark > Digispark Projects

Tutorial: Convert a Digispark in to a LittleWire AVR/PIC programmer and IO multitool, or ttl serial

(1/4) > >>

Bluebie:
I've created a quick little screencast explaining how to upload the LittleWire firmware to a digispark, turning it in to an AVR/PIC programmer, as well as allowing access to all of LittleWire's other features. It's a handy tool for experimenting as it lets you talk to SPI, i2c, and 1wire devices from languages including c, c++, c#, python, ruby, and processing. Ihsan - the creator of LittleWire also helped create some of the software used by the DigiSpark - the micronucleus program we'll be using to upload our program.

An AVR programmer is particularly handy because you can buy the same ATtiny85 chips used by the Digispark in their raw form for about $3 each, and by hooking them up with a programmer you can upload Digispark programs directly on to them. They're a little bit smaller, but they don't have the USB port or power regulator, so they need to be powered by a five 4.0-5.5 volt power supply - a USB phone charger works great! A couple of dollars cheaper might not seem like much, but it's been very important for me when doing art installations which used ten or more chips to drive large collections of lights.

Using the LittleWire libraries (including the ruby version I made) you can quickly experiment with talking to accelerometers, temperature sensors, iButtons, RFID readers, analog sensors, servos, and all sorts of other gadgets in a more concise language than the C-based code used in the Arduino software. I especially like using Ruby because the Interactive Ruby program lets you type in and run code line by line, seeing the return values of functions immediately. It really is a much nicer way to experiment than trying to print out debugging stuff through DigiUSB or serial ports or whatever else. If you're going to leave your device plugged in to a computer anyway it often makes more sense to write all the code on the computer and just puppet it with a firmware like LittleWire too.

Digispark LittleWire tutorial from Jenna Fox on Vimeo.

LittleWire homepage: http://littlewire.cc
LittleWire Github Download: https://github.com/kehribar/Little-Wire

The process should be very similar on other operating systems - you'll just need to find the micronucleus binary in the digispark arduino installation in another way, and I'm not sure if the dragging files on to a terminal will work on every operating system.

dmcinnes:
Very cool. I've been using my arduino duemilanove to program attiny85s, it would be nice to wire up a digispark proto board with a socket for compactness  :)


How would you wire this up?

dmcinnes:
Helps if I look at the documentation:
http://littlewire.cc/documentation.html



I was able to get the bootloader running and got avrdude connecting. I couldn't get it to see any chips I wired in using the pinout in those docs.


Looking at the LittleWire board pinouts it looks like it's using pins 2 and 3 for USB and the digispark uses pins 3 and 4.
http://solderpad.com/ihsan_kehribar/minimal-avr-programmer-and-more/


Digging further into the source for main.hex it looks like it's actually using different pins for MISO, SCK, RESET and MOSI:
https://github.com/littlewire/Little-Wire/blob/master/v1.1/firmware/source/main.c#L113-L116


That works! I have the blink sketch running right now.


For the curious the pins are basically 1 to 1:



DigiSpark => ATtiny85
pin 0        pin 0 (MOSI)
pin 1        pin 1 (MISO)
pin 2        pin 2 (SCK)
pin 5        pin 5 (RESET)

Don't forget you need to wire up 5V and Ground for the ATtiny85!

Bluebie:
I don't understand how you came to those conclusions. The LittleWire uses exactly the same wiring as a digispark - it just lacks the external voltage regulator, and has slightly different resistor values. The USB D- and D+ lines are clearly connected to PB3 and PB4 in the schematic just as with the digispark.


Glad you got it working though ^_^

dmcinnes:
Heh I'm new to all this programmer business. I didn't realize the documentation was referring about the ISP header (though I didn't have any idea what that was until recently). I thought it meant the pins on the chip.
I saw the numbers on the lines of the schematic and thought that meant the pins instead of the PB numbers:
http://solderpad.com/ihsan_kehribar/minimal-avr-programmer-and-more/
Those are the physical pins, huh.


In any case, source code does not lie!  :P

Navigation

[0] Message Index

[#] Next page

Go to full version