ATtiny85 Galloping Ghost decoder

Waggly tails
Twitcher
Posts: 53
Joined: 16 Feb 2018, 12:17

Re: ATtiny85 Galloping Ghost decoder

Post by Twitcher »

Fair comment Mike, but my unvarying practice is to assign "Throttle Cut" to a two-position switch (Switch H for those with the same Tx) at the rear top/right hand side of my DX9 tranny. This switch disables the (electric) motor until I'm at the flightline, controls checked, and ready to take off.

As soon as the model has landed, the motor is again disabled via that switch.

I've just re-assigned the Gear channel (which I'm using to switch on/off the GG actuator) to that same switch "H", so the two functions now work in tandem. Experience may change my mind about this but I want to try it out because it will now be impossible to take off without the actuator running. Confession time: a couple of years ago at Ponty I nearly did exactly that with my Robot, which had a manual switch to turn on/off the actuator power. It was only a timely warning from Phil that prevented the ensuing carnage!

The switch is well out of the way; it's never been triggered accidentally and I don't anticipate it ever will be. Fingers crossed . . .

And yes, the Gear channel settings will never be changed while Martin's recoder is installed in the model. :P

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

Re: ATtiny85 Galloping Ghost decoder

Post by Martin »

Quick update to let you know I've done a software upgrade. Once you've uploaded the new software version, you then have access to (at least) four different modes of operation on the same board without further reprogramming.

1. Existing mode where motor/actuator is pulsed left/right with 'coast' intervals between pulses to vary power.

2. Same as 1 except that you connect a preset potentiometer (pot) to control the power to the AUX input, instead of a radio channel.

3. Fast PWM mode - better suited to magnetic actuators - the motor/actuator is driven all the time with no 'coast' intervals, but the power is controlled by fast (8kHz) switching PWM with 256 levels of power available from 0% to 100% - power is controlled by a radio channel into the AUX input, as in mode 1.

4. Same as 3 except that you connect a preset potentiometer (pot) to control the power to the AUX input, instead of a radio channel.

You select one of the four modes by powering up the unit with jumpers linking the input channels - the program senses the jumpers, reads the selected configuration and writes that to EEPROM. From then on when you power up in the normal way, the program reads the configuration mode from its EEPROM and runs in that mode.

Program is tested and working, but before I upload it, I'd like to add a fifth mode that automatically calibrates the operating frequency of the chip's internal oscillator to exactly 16MHz - if I can do this it should eliminate the slight left/right trim offsets I'm seeing between one unit and the next due to the variation of the chips' internal oscillator speeds.

I'll upload the program anyway in the next week, but I thought I'd try to get the oscillator calibration done first to save people upgrading twice. Anyone who already has a unit and has a suitable programmer such as a USBASP will be able to upgrade to the new 4-mode (or 5-mode) version if they wish, as there are no hardware changes.
User avatar
Wayne_H
Posts: 809
Joined: 17 Feb 2018, 05:26
Location: Temora, NSW. Australia
Contact:

Re: ATtiny85 Galloping Ghost decoder

Post by Wayne_H »

Martin,

You've been busy ;) These all sound like excellent additions which I'm looking forward to "evaluating", er, um, fiddling/playing with :lol: .

I was intending today or tomorrow to try your board with several different Ace actuators. I've already added a voltage regulator to suite the 3.7(ish) volt requirements of the Ace actuators, as I did with Phil's PIC re-coders. I think I'll hold off until your revised code is available (no pressure intended or implied :P :shock: :lol: ).
Cheers,

Wayne
Once a Retrobate, always a Retrobate............ ;)
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: ATtiny85 Galloping Ghost decoder

Post by Martin »

I've uploaded the new version that supports the alternative configurations to the opening post. By default it works the same as before. This will be the default sketch for any new boards I build from now on - but of course those who already have boards won't have the new features unless and until they upload the new sketch.

I'll update the manual in due course but briefly, for those who wish to play - you need to upload the new sketch to the board. By default it will work just the same as before. To try the alternative configurations:

Power up the board with a link joining the ELE and AUX input pins. Then power down, remove the link - this will subsequently cause it to run in 'Configuration 2'. You can use the little red link I normally supply with the boards that links the logic power to the motor power, if you wish.

To put it back to the default configuration (1), same procedure but with the link joining the 'RUD' and 'ELE' input pins.

For configuration 3 link the RUD, and ELE input pins AND ALSO link the AUX pin to GND (you can use a Spektrum or similar 'bind plug' for that).

For configuration 4, link the ELE and AUX input pins with the link AND ALSO link the RUD pin to GND.

Configuration 1: (default) Normal 'pulsed' operation with (optional) control of power by a receiver channel on the AUX pin.

Configuration 2: same as 1 but uses a pot on the AUX channel instead of a radio channel to control power.

Configuration 3: same as 1, but the 'power' is varied using fast (8 kHz) PWM instead of pulses with coast intervals. You can edit the sketch to switch the PWM speed in stages up to 62.5 kHZ if you wish - but I found that 8 kHz seems to work well (theoretically the H-bridge chip wastes more power at higher PWM speeds - though it is rated for up to 100 kHz operation).

Configuration 4: pot on the AUX channel controls power using PWM.

There is also a Configuration 5 for testing/altering the board's clock speed. The board outputs a 1 kHz square wave on its ELE pin. It also outputs (serially) its current OSCCAL (oscillator calibration value) and listens for commands to vary and store the OSCCAL value. You put the board into this mode by linking RUD, ELE, and AUX together. Normally you wouldn't do this by hand but instead connect the board to an Arduino UNO or similar - that UNO then runs a special sketch used to check/alter/store the OSCCAL calibration of the board. I've uploaded that sketch too - and eventually I'll update the manual to cover how to operate it.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: ATtiny85 Galloping Ghost decoder

Post by Martin »

For speed calibration, I just plug the boards into a UNO.
speedCalibration1.JPG
The pulser board is powered by the UNO for calibration - via its Pin 13. As Pin 13 has an on-board LED, this lets you see when the board is powered up. You can see I used a red wire into Pin 13 and a black wire to the adjacent GND terminal - and these connect to the pulser board where you'd expect.
speedCalibration2.JPG
The UNO also has three push-buttons attached to its Pins 2, 3, 4. These are just momentary buttons that connect to GND when pressed.

Run the sketch on the UNO, switch to the console (monitor) view in the Arduino IDE (Ctrl-Shift-M). Set the monitor speed to 115200 baud. Once the UNO has powered up the pulser you should see a measured frequency and an OSCCAL value scrolling up the screen.

The pulser tries to send out a frequency of exactly 1000 Hz, but of course if its clock is running too fast or too slow the frequency will be a little away from 1000. Press the button on pin 2 (+) to increase the value of OSCCAL and therefore the frequency, and similarly the button on pin 3 (-) to reduce the speed. When you've got it as close as possible to 1000 Hz, press the button on pin 4 (W) to write the OSCCAL value to the EEPROM.

Note that there is a discontinuity in the OSCCAL response at the 7F to 80 position. The frequencies increase from 00 to 7F and increase again from 80 to FE, but there is a backwards jump in speed as the 7F to 80 boundary is crossed. The two regions overlap so you may find pairs of OSCCAL values that give the same frequencies in roughly the 70 to 90 region.
Post Reply