DigiSpark Version

A project log for Spectrum Analyser Code

Code for a spectrum analyzer.

agpcooperagp.cooper 10/27/2016 at 07:530 Comments

The DigiSpark (ATTiny85) Version

Well that was the original idea concept.

For the DigiSpark I had to write the LCD code as the DigiSpark does have enough memory for a "frame buffer" making "graphics" rather difficult (so no ready made libraries).

There are lots of code examples on the internet (Jilian Ilett's site is very good one:

I used those examples but added the (very limited) graphics that I required.

Here is the assembled project reading a 0-3v 1 kHz square wave:

The DigiSpark CPU clock is about 16.5 MHz but the micros() statement appears to assume 16 MHz.

I had to scale micros() by 16.9/16.0 to get the correct frequency response.

Here is the adjusted display:

So all done.

Problems with the DigiSpark

The DigiSpark I am using is a cheap clone and the fuses have not be set to allow the use of PB5, the Reset pin.

Yes if you try to use as an input, it it will reset the DigiSpark, also it will not let you use it as an output.

That is why I said previously the DigiSpark had only 5 IO pins.

Well that can be fixed with a high voltage (12v) programmer so I should look into it if I use the DigiSpark more often.

Also a Reset take 5 seconds to give the USB connection a chance before actually rebooting. That can be fixed as well (there is a no wait boot loader that checks the reset pin status first).

Programming the DigiSpark Fuses

I found this site that steps through the solution:

Now I have a ATTiny85 programmer shield for the Arduino UNO so I checked the schematic (all good) and uploaded ArduinoISP.

But if you don't have a sheild then you can just wire it up as per the web-site instructions.

The only thing I did not do is add the Reset capacitor recommended by the web-site..

Next I have XLoader that has AVRDude, so I put a batch file in the directory and ran it.

Now AVRDude is also part of the Arduino IDE so you have a copy of AVRDude.

All good the first time.

Tested the DigiSpark and all good.

Here is the batch file if you ever need it:

Echo Read the signature should be: 0x1e930b
avrdude -P com5 -b 19200 -c avrisp -p attiny85 -n
Echo Ready to write fuses? Kill window if not!
avrdude -P com5 -b 19200 -p attiny85 -c avrisp  -U hfuse:w:0x5F:m