ATtiny85 GG decoder - DIY thread

Waggly tails
Post Reply
Martin
Posts: 198
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

ATtiny85 GG decoder - DIY thread

Post by Martin » 11 Feb 2019, 10:14

This is the thread for home-brew versions of the ATtiny85 Galloping Ghost driver. As you can see in the video, all you really need is the bare ATtiny85 chip, and a resistor. An alternative would be to use one of the small ATtiny85 boards for sale on Ebay for a few pounds that have a built-in USB port for programming - something like this:

Image

Disclaimer: I've not tried running my sketch on one of these boards yet. I think it will work, but it would be nice if someone could try it to see if there are any issues with the USB bootloader or the on-board LED (if there's one fitted). It's unlikely there will be any problems, and if there are any they can probably be fixed by a small change to the sketch.

You'll most likely want to add a H-bridge driver, and again these can be had on Ebay for a pound or so. There are several types available. Here's a typical cheap Ebay version.

Image

Or the Pololu 2135, available from Pololu and various resellers, is a little more compact and with a better chip, though it does cost slightly more.

Image

You do not have the required permissions to view the files attached to this post.

Stewart
Posts: 7
Joined: 17 Feb 2018, 04:57

Re: ATtiny85 GG decoder - DIY thread

Post by Stewart » 11 Feb 2019, 13:21

Can also use one of these to program a DIP chip":- https://www.ebay.com/itm/Micro-USB-Mini ... :rk:1:pf:0
You do not have the required permissions to view the files attached to this post.

Martin
Posts: 198
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: ATtiny85 GG decoder - DIY thread

Post by Martin » 15 Feb 2019, 12:21

I got two types of the Digisparks (Chinese clones) surface mount AtTiny85 to test: the one with the micro USB connector and the one with the full-size USB 'edge connector' as part of the PCB. I'm still waiting for the third type (the one with the DIL socket for the ATtiny chip) to arrive.

Findings so far:
  • The bootloader waits for five seconds after power on before executing the sketch - this doesn't matter when switching on the 'galloper', as waiting five seconds is no big deal. It would be bad news if there was a momentary 'brown out' while flying - as you'd then experience five seconds loss of control, but a brown-out shouldn't happen anyway.
  • If you have a USBASP, you can program the chip using that (and overwrite the bootloader to eliminate the start-up delay - and remote chance of the 'brown out problem'). However, you won't then be able to upload via USB unless you use the USBASP to re-install the Digispark bootloader.
  • There are 3.6V zener diodes and in-line 68-ohm resistors on the two I/O that drive the H-bridge, also a 1k5 pull-up resistor on one of them (these are the two pins used for USB programming in the Digispark system). I don't think this will affect the operation of most H-bridges, but I've not tested all types.
  • Pin 1 (used for elevator input by my sketch) drives an on-board LED (to ground) via a 1k resistor. I don't think this will be a problem - radio receivers are easily capable of driving into a 1k load.
  • On the 'clone' chips, P5 (unused by my sketch) is bought out to a pin but can't be used as it's left enabled as a reset pin. On the official Digispark, a fuse is set that allows this pin to be used as an extra I/O. As my sketch doesn't use this pin it makes no difference. If you want to enable the pin to gain an extra I/O line you can do it by setting a fuse using a USBASP programmer - then you can still upload by using USB. If you want to revert to not using the USB bootloader you then need a high-voltage (12V) programmer to reset the fuse - you can't reset the fuse using a USBASP. and you can't program the chip (AFAIK) with a USBASP until the fuse is reset.
I'm currently making a home-brew magnetic actuator so I can test the sketch with that as well as the motorized galloping ghost.

Mike_K
Posts: 153
Joined: 16 Feb 2018, 06:35

Re: ATtiny85 GG decoder - DIY thread

Post by Mike_K » 16 Feb 2019, 08:32

Hi Martin

What ATtiny core and bootloader are you using? It makes a big difference, as an example, Arduino Nano's come with the original Arduino bootloader and show similarly slow boot times, but if you flash them with the Opti bootloader, the boot time is <0.5secs. The Opti bootloader also has the advantage that it only takes 512 bytes the original bootloader 2K. Why any Arduino's are still shipped with the original bootloader defies logic. At least the Uno ships with Opti.

I don't know what ATtiny core you are using with the Arduino IDE and hence which bootloader. You should be able to tell which bootloader is being used from ATtiny85 section of the boards.txt file. As a quick check, you could just compile a program/sketch and see how much flash is reported as being usable. The original Arduino bootloader takes 2K so it would report maximum 6144 bytes (8192-2048=6144) , the Opti only takes 0.5K so would report 7680 bytes (8192-512=7680).

To use a ATtiny core with the Opti bootloader this is the one I've used in the past, even though it says it's beta, it worked OK for me:

https://github.com/TCWORLD/ATTinyCore

Mike

Martin
Posts: 198
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: ATtiny85 GG decoder - DIY thread

Post by Martin » 16 Feb 2019, 12:47

Mike, thanks for that info.

The "Digispark" micronucleus bootloader is very different to the AtMega one. The latest ATtiny85 version (2.04) uses 1588 bytes. There is a version that only uses 1418 bytes. The ones I have all display the following information during the upload process:

Code: Select all

> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
So it looks like they're using this old 1.06 version that uses 2180 bytes. I know the page says 1.06 and the message says 1.6 but I believe they're the same.

The size of the bootloader doesn't matter for my Galloping Ghost sketch, as the sketch is tiny. It would be nice to alter the start-up delay, but I doubt if most people using my sketch will bother.

The bootloader source code is available and it's easy to alter the 5-second start-up time. The problem is that to burn a modified bootloader to the chip you need a USBASP or similar programmer, and if you have one of those then you can just upload the sketch using it and eliminate the bootloader entirely.

Tobe suggested this thread for people to use the off-the-shelf ATtiny85 boards in a simple DIY way, and if you buy one of these ATtiny85 Digispark clone boards it will most likely come with the 5-second bootloader - probably the same old 1.06 version of the micronucleus bootloader that my boards came with. Many people building the DIY project won't have a programmer and will just want to plug the board into USB and upload the sketch. Anyone who has a USBASP or other programmer can, of course, use that as an alternative.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest