Tuesday, February 5, 2013

Sparky and His Brothers Arrive

I was very excited to see my packet arrive from the guys down at digiStump.com Inside I found the three DigiSpark micro-controllers that I ordered from the Kickstarter page. My first purchase from a Kickstarter project and I'm pleased!

The tiny boards came in antistatic bags, but I show them removed in the photo on the left. All of the parts were loose in the envelope so things went flying a bit when I tore into it. One of the headers turned up missing, but my wife found it on the floor later.



The directions on the web site suggest that we solder headers on the board and then use the pins to plug it into a breadboard. It seems like a good idea, but I have two issues with it. First, if you do this, the board plugs in upside down which makes it impossible to see the status of the two LEDs. 
Poster's update: My new breadboards have now arrived and I can clearly see that I was not correct about the alignment on the board. It was simply a matter of flipping the board around. On one side the + rail is on the outside and on the other it is on the inside. 
It is clever though, that they spaced everything so that the GPIO pins fan out along the side of the main breadboard workspace and the 5V and GND pins fit right into the power rails along side the board, IF you have two rails on the side of the board. My breadboard has only one rail on each side. So this won't work at all. I do have a small breadboard that would work just fine, but it is currently occupied with a ham radio Arduino project that I am developing. I wasn't willing to vacate that board for Sparky. As luck would have it, I had ordered a few new boards with double rails a week ago.

As I plan to use one of the boards just for development and imbed the others onto a protoboard later, I decided to solder a section of six pins right to the bottom of the board and install the three pin header to the top as they recommended. This allows me to connect two jumper wires between the board and the power rails.

DigiStump has a wiki set up to walk you through the steps for getting started. I tried installing the IDE on both my XP and Win7 machines. I had difficulty with each one and it took some fooling around to get it working. Part of that may have to do with the fact that I already have the Arduino IDE software installed on my computers and Sparky needs a different version. I did get it running, though. I thought I should be able to select a port in the 'tools' menu as you do with the Arduino, but the option was gray!. So went looing for it in the 'Control Panel.'  I expected to find the board in the 'Ports' section of device manager, but not so. That prompted me to try installing again and trying it on another computer. Finally by plugging and unplugging the board while I was in device manager It appears as a new item, higher in the list, under 'libusb-win32 Usb Devices.' It shows up on the IDE as COM5.

The DigiSpark is designed so that the tab on the board will fit into a USB jack. Unfortunately this is not as clean and solid as a regular USB plug would be. For one, you can plug it in upside down. Now that is something I've never been able to do before so I didn't give it much thought. It looks like there is no way to do any harm by plugging it in upside down, but I can attest to the fact that it doesn't work!

Sparky comes already programmed with the 'blink' sketch, so if you plug it in, it should start working right out of the envelope. The power LED comes on first. Then there is about a 5 second delay and the second LED will start blinking. Both of these are green. The delay is a cool part of the design. This little window of time allows Sparky to figure out if your are teaching him a new trick (ie, programming) or expecting him to perform. It's real clever the way they do this. You need to make sure that board is unplugged when you click the 'Upload' button in the IDE. You will see a message appear when it wants you to plug it in.

This 'plug in when prompted' scheme created a problem for me that took a while to figure out. The first few times I tried it, it did not work. I restarted my computer. I reinstalled the drivers. It would not work. The LEDs didn't even come on. What I learned was, that I needed to wiggle the board a little in the USB jack and make sure I was getting good contact. The board is loose enough that it has to be aligned just so. Once I got that sorted out, it worked fine.

I have experienced some issues with my Kaspersky Security Software while trying to upload sketches to my Arduino. With longer programs, that process can take several minutes unless I disable Kaspersky when I upload. I expect to see the same problem with Sparky. I keep the security window open and only disable it for the few seconds it takes to upload the code.

Pay attention to the precautions you find on the DigiSpark Wiki:

Precautions:

The Digispark, due to its small size and low cost is not as robust as a full blown Arduino.
When testing a new circuit we recommend that you test it with an external power supply first. Connecting a shorted circuit to the Digispark and connecting it to your computer could damage your computer and/or its USB ports. We take no responsibility for damage to your machine as a result of the use of a Digispark.
We strongly recommend connecting your Digispark through a USB hub which will often limit the damage caused by a short circuit to the usb hub. For the record, we've found many computers have usb fuses built in, and when we blew them on our 27” Mac monitor, thankfully they reset and everything worked after a power down.
The Digispark does not have short circuit or reverse polarity protection. Connecting power to the Digispark power pins backwards will almost certainly destroy it.
The Digispark is small enough to present a choking hazard and small enough to be inserted into some sockets. We take no responsibility for miss-use of the product. Please treat electricity and electronics with respect and common sense.
I find it easy to pull Sparky off of the breadboard when I upload so that nothing else is hooked up to it. Currently I am using an Arduino plugged into my laptop as a power supply doing nothing but piping 5V and GND to the project.

My first project will be a game that uses an LCD display. It will also give me a chance to work with I2C which is all new to me. It is a repeat of an Arduino project that I have done before. 

I soon learned that I needed to run a real simple sketch the first time, just to confirm that I was actually teaching Sparky a new trick. So I looked at some of the examples that installed with the IDE. That can be confusing, because most to them are Arduino sketches that use I/O pins that aren't even on the DigiSpark. You want to be sure you drill into the DigiSpark folder when looking for something to try. Before I realized that I was having a connection issue with my USB I resorted to simply reloading the 'blink' program, changed the first delay to 3000 so that I could confirm that it loaded by watching the blink rate. If you want to do the same thing, the sketch is called 'start'. 




2 comments:

  1. What operating system are you using?

    I imagine you used the software that came from the digispark team, and not just the basic Arduino IDE. Well, they give a version of the Arduino IDE with what you need for the digispark...

    ReplyDelete
    Replies
    1. Yes, Alan, I used the one digistump provided. They said that they had modified it for use with the digispark and that the regular one would not work. I was concerned that I would have issues because I already have the latest version from Arduino installed on my computer.

      I have run it on both my XP and Win7 machines. I prefer my XP ... it's the machine I write all my software on.

      Delete