onboard glo driver?
-
- Posts: 14
- Joined: 13 Nov 2018, 23:47
- Location: Australia, NSW
Re: onboard glo driver?
@Phil_G Well, you learn something every day. I had no idea that selecting "colour" meant selecting a product. Stupid me, I though it had something to do with colour.
Thanks for the tip, I'll know better next time.
:-\
Thanks for the tip, I'll know better next time.
:-\
Why would I buy something for $7 when I can make it myself with just $250 worth of equipment and materials.
-
- Posts: 349
- Joined: 19 Jun 2019, 04:09
Re: onboard glo driver?
First stage confirmation test of the circuit as per the new pcb.
Note that this part of the testing is done on a breadboard. ie low current.
Note that this part of the testing is done on a breadboard. ie low current.
- Phil_G
- Posts: 783
- Joined: 15 Feb 2018, 23:32
- Contact:
Re: onboard glo driver?
Hi Jeff I sent a PM last Tuesday, I know its easy to miss PMs on here
Cheers
Phil

Cheers
Phil
-
- Posts: 782
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: onboard glo driver?
I've coded an Arduino sketch to suit bluejets' PCB. I don't have one of his PCBs to test it with, but I'm pretty confident it will work.
The sketch mostly uses the chip hardware to drive PWM output to the IRLB3034 FET. That FET is specified to switch up to 100 kHz, so my sketch clocks the 8-bit PWM counter at 62.5 kHz. This gives an actual PWM output frequency of 244 Hz - plenty fast enough for any glow plug!
The sketch monitors the input channel from the receiver, measuring its pulse widths in microseconds - it uses Timer 1, and interrupts, to do this because:
The PWM output remains off at power up, till a valid pulse width is received from the receiver (pulse between 1.1 ms, and 2.5 ms long in a frame width shorter than 50 ms - so a minimum of 20 frames per second ).
The sketch also switches the glow off, if the input signal from the receiver ever stops - whether it stops with a high or low signal.
The sketch assumes the AT tiny is running using a 16 MHz internal clock, so make sure to 'burn bootloader' with that setting chosen.
The sketch mostly uses the chip hardware to drive PWM output to the IRLB3034 FET. That FET is specified to switch up to 100 kHz, so my sketch clocks the 8-bit PWM counter at 62.5 kHz. This gives an actual PWM output frequency of 244 Hz - plenty fast enough for any glow plug!
The sketch monitors the input channel from the receiver, measuring its pulse widths in microseconds - it uses Timer 1, and interrupts, to do this because:
- Using Timer 0 for the PWM output and changing it to run at 62.5 kHz, messes up the Arduino micros() function.
- micros() only resolves to 4 microsecond intervals anyway, and my method resolves to actual microseconds and so is four times more accurate (not that this really matters for this application).
The PWM output remains off at power up, till a valid pulse width is received from the receiver (pulse between 1.1 ms, and 2.5 ms long in a frame width shorter than 50 ms - so a minimum of 20 frames per second ).
The sketch also switches the glow off, if the input signal from the receiver ever stops - whether it stops with a high or low signal.
The sketch assumes the AT tiny is running using a 16 MHz internal clock, so make sure to 'burn bootloader' with that setting chosen.
- Attachments
-
- ATtiny85GlowDriver.ino.zip
- First version, uploaded 2024-07-14
- (1.78 KiB) Downloaded 56 times
-
- Posts: 349
- Joined: 19 Jun 2019, 04:09
Re: onboard glo driver?
Hi Martin,Martin wrote: 14 Jul 2024, 18:30
The sketch drives the PWM output proportional to the received value from the receiver, so you can adjust how bright the glow plug glows from your transmitter, if you want. But the sketch also reads the 'analog' input from the trim pot, and uses that to control the maximum PWM output value - so if you wish you can use a straight 100% switch channel on the radio to switch the glow plug between glowing and off, and use the trim pot to set how bright the glow plug glows when 'on'.
You have been busy again....... I've been otherwise occupied down in Brisbane getting tests for stage 4 cancer that seemingly came from nowhere, ie no symptoms.
Anyhow enough there, just wondered if you could explain the above a little more .........
As it reads like the "glow amount" is proportional to the throttle setting (up to limit set by trimpot) from zero or near to, up to this pre-set max value.
Normally the glow (in the previous code) comes on at it's maximum preset value at around low throttle setting and remains on until throttle gets to near mid point.
These two values are adjustable in the code which seemed like a good idea.
Code: Select all
// ---------------------------- USER CONFIGURATION -----------------------------------
// The glow driver will be turned ON between the minValue and the maxValue
// In ersky9x/er9x the channels normally range between 988 and 2012 milliseconds.
// Better to set the minimum value a bit under 988 to avoid the glow plug driver turning OFF when throttle is at idle
#define minValue 980 //Insert the minimum Value in ms (milliseconds)
#define maxValue 1300 //Insert the maximum value in ms (Milliseconds)
I can put the gerber files in here to match the PCB in "panalize" but as yet have not done the final "power" test to the glow plug.
Drop a note in here if gerber required.
Video 9_7_24 showed the switching according to plan but the last test has been held up due to the health condition I mentioned.
Today is first day back at my workshop.
-
- Posts: 782
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: onboard glo driver?
Sorry to hear about the cancer tests, Jorgo. I hope that the test results, plus any treatment and recovery, if necessary, happen speedily.
I don't plan to make any boards myself, so no worries on the gerber files - I just thought it was an interesting coding challenge to do on one of my AT tiny 85 dev boards. Mine has an LED on the PB1 output, but it only takes a minor change to the sketch I uploaded here to drive the PWM output to that pin instead of the PB0 that your board uses, and I can then monitor the 'glow amount' by watching the LED brightness.
Yes, my sketch has the 'glow amount' off for narrow incoming pulses from the radio, and then gradually increasing as the incoming pulses widen, up to a maximum value set by the trimpot. I assumed that you'd use a separate channel for the glow plug control to the one driving the throttle servo, so it would be easy to reverse that channel to work the way you describe - and override the value with a switch so that the glow can be switched off, saving the glowplug and glowplug battery while tinkering with the engine. Of course, this assumes that your radio system has a spare available channel, and some method on the transmitter, of mixing the throttle stick to that spare channel.
If you're using an older transmitter, with no mixers, and you want to drive the glow plug board from the same channel that controls the throttle servo using a Y-lead, it still depends which way round the throttle servo works - there's no guarantee with an I.C. engine and servo-driven throttle that tick-over will be when the pulse width of the controlling radio input is narrowest.
If you do need to use a Y-lead on the throttle channel, it will be easy to tweak my sketch, if necessary, to work the 'other way round', and to alter or remove the glow-amount-controlled-by-the-radio, feature, so your could just have the radio acting as a glow-on-off switch, with the glow amount set by the trimpot.
I recommend trying out the sketch with your board. Initially just watch the LED, and once that is coming on and off, the way you want (and, to begin with, set to a maximum of not-very-bright by the trimpot) you can connect up a glowplug and experiment with that.
Let me know if you want any tweaks made to my sketch - that's if you decide to use it, and are having trouble figuring out how to change it yourself.
I don't plan to make any boards myself, so no worries on the gerber files - I just thought it was an interesting coding challenge to do on one of my AT tiny 85 dev boards. Mine has an LED on the PB1 output, but it only takes a minor change to the sketch I uploaded here to drive the PWM output to that pin instead of the PB0 that your board uses, and I can then monitor the 'glow amount' by watching the LED brightness.
Yes, my sketch has the 'glow amount' off for narrow incoming pulses from the radio, and then gradually increasing as the incoming pulses widen, up to a maximum value set by the trimpot. I assumed that you'd use a separate channel for the glow plug control to the one driving the throttle servo, so it would be easy to reverse that channel to work the way you describe - and override the value with a switch so that the glow can be switched off, saving the glowplug and glowplug battery while tinkering with the engine. Of course, this assumes that your radio system has a spare available channel, and some method on the transmitter, of mixing the throttle stick to that spare channel.
If you're using an older transmitter, with no mixers, and you want to drive the glow plug board from the same channel that controls the throttle servo using a Y-lead, it still depends which way round the throttle servo works - there's no guarantee with an I.C. engine and servo-driven throttle that tick-over will be when the pulse width of the controlling radio input is narrowest.
If you do need to use a Y-lead on the throttle channel, it will be easy to tweak my sketch, if necessary, to work the 'other way round', and to alter or remove the glow-amount-controlled-by-the-radio, feature, so your could just have the radio acting as a glow-on-off switch, with the glow amount set by the trimpot.
I recommend trying out the sketch with your board. Initially just watch the LED, and once that is coming on and off, the way you want (and, to begin with, set to a maximum of not-very-bright by the trimpot) you can connect up a glowplug and experiment with that.
Let me know if you want any tweaks made to my sketch - that's if you decide to use it, and are having trouble figuring out how to change it yourself.
-
- Posts: 349
- Joined: 19 Jun 2019, 04:09
Re: onboard glo driver?
So at the idle position where one wants to start the engine and the glow is needed the most, you have it set to be a "low glow".
I do not see the need to alter the glow level once a value has been set by any "maximum level" pot.
However I do see the requirement to alter the on and off points easily.
As you say, use a separate channel would be easy enough as most have radios these days easily capable of that.
Question then would be how to totally turn the glow off.
Edit:- I think here ...old saying as they say...open eyes first , then the gob.
Mine has an LED on the PB1 output, but it only takes a minor change to the sketch I uploaded here to drive the PWM output to that pin instead of the PB0 that your board uses, and I can then monitor the 'glow amount' by watching the LED brightness.
Your code says pwm is P0....?? Don't see any reference to P1
I do not see the need to alter the glow level once a value has been set by any "maximum level" pot.
However I do see the requirement to alter the on and off points easily.
As you say, use a separate channel would be easy enough as most have radios these days easily capable of that.
Question then would be how to totally turn the glow off.
Edit:- I think here ...old saying as they say...open eyes first , then the gob.

Code: Select all
uint16_t pw = rx_pulse_width > 1883 ? 255 : rx_pulse_width > 1116 ? (rx_pulse_width - 1116) / 3 : 0;
Your code says pwm is P0....?? Don't see any reference to P1
Code: Select all
#define PWM_PIN 0
-
- Posts: 782
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: onboard glo driver?
That's right. The version I uploaded here is for your board, not mine.
You'll see in the function that sets the pwm output, that it turns the output off completely by switching that pin to input mode - that allows the pin to float, but your PCB has a pulldown resistor that ensures the FET then turns off. Any other level of PWM from 1/255 up to always on 255/255 is done by writing to the output compare register, OCR0A, but you can't turn it completely off by just writing zero to that register - the way the chip does PWM means that the the output still has narrow high spikes, for the zero value.
You'll see in the function that sets the pwm output, that it turns the output off completely by switching that pin to input mode - that allows the pin to float, but your PCB has a pulldown resistor that ensures the FET then turns off. Any other level of PWM from 1/255 up to always on 255/255 is done by writing to the output compare register, OCR0A, but you can't turn it completely off by just writing zero to that register - the way the chip does PWM means that the the output still has narrow high spikes, for the zero value.
-
- Posts: 782
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: onboard glo driver?
I agree that you probably don't need the glow level to alter as the throttle stick is moved - simple on/off control of the glow is enough.
But the idea of my sketch is that you can control how brightly the glowplug glows from your transmitter, which might be more convenient than having to access the trimpot onboard the model.
Once you have in mind that the glow control radio channel is separate to the throttle control channel, it becomes simple on a modern transmitter to set it up. Say you use channel 6 for the glow - then you want channel 6 to output, say, 50% from zero throttle up to quarter throttle, and 0% (or -100%) otherwise - and you could also have channel 6 overridden to 0 or -100% by a switch on the transmitter - maybe a switch dedicated just for that, or the same switch you use as a throttle kill switch.
Of course, you can tweak the Arduino sketch to do all the work, but the disadvantage of that is you may need a different sketch for each model that you've installed a glow driver board on, depending on whether the throttle servo is reversed, and so on. If you have a computer radio that can do mixing, then you can use the same Arduino sketch on every board.
You might also use your board to control other switched functions - landing lights for example - and then you'd want the transmitter mixing to operate some other way.
But the idea of my sketch is that you can control how brightly the glowplug glows from your transmitter, which might be more convenient than having to access the trimpot onboard the model.
Once you have in mind that the glow control radio channel is separate to the throttle control channel, it becomes simple on a modern transmitter to set it up. Say you use channel 6 for the glow - then you want channel 6 to output, say, 50% from zero throttle up to quarter throttle, and 0% (or -100%) otherwise - and you could also have channel 6 overridden to 0 or -100% by a switch on the transmitter - maybe a switch dedicated just for that, or the same switch you use as a throttle kill switch.
Of course, you can tweak the Arduino sketch to do all the work, but the disadvantage of that is you may need a different sketch for each model that you've installed a glow driver board on, depending on whether the throttle servo is reversed, and so on. If you have a computer radio that can do mixing, then you can use the same Arduino sketch on every board.
You might also use your board to control other switched functions - landing lights for example - and then you'd want the transmitter mixing to operate some other way.
-
- Posts: 349
- Joined: 19 Jun 2019, 04:09
Re: onboard glo driver?
This latest video is of the power section of the onboard unit.
Previous was the control section.
Note I am running the ATTiny85 on receiver voltage level, not via the 3v3 regulator.
https://www.youtube.com/watch?v=omDYsXIL__M
Previous was the control section.
Note I am running the ATTiny85 on receiver voltage level, not via the 3v3 regulator.
https://www.youtube.com/watch?v=omDYsXIL__M