Onboard Motor Timer

Arduino projects on the go
User avatar
Carl
Posts: 267
Joined: 16 Feb 2018, 13:26
Location: Way down in the South West
Contact:

Onboard Motor Timer

Post by Carl »

This came about because I wanted to use my Mattel pulse proportional set for my Pulstar build. Also I wanted to be able to set a throttle position (power) as well as motor run time.

WP_20180507_12_12_47_Pro.jpg

I've made a few small changes to the specification from before:

* By means of dip switches 1 to 5 you can set a motor run time of up to 155 seconds in increments of 5 seconds (longer run times are possible by reprogramming using a different increment value) - dip1 = 5; dip2 = 10; dip3 = 20; dip4 = 40; dip5 = 80 - to set 60 seconds set dip3 and dip4 ON

* By means of dip switches 6 to 8 you can set motor power as a percentage in units of 10s (there is a minimum setting of 30%) - dip6 = 10; dip7 = 20; dip8 = 40 - to set 80% set dip6 and dip8 ON

* Upon switch-on the esc is initialized with min/max throttle range - the esc will give the usual confirmation beeps

* After esc initialization there is a period of 10 seconds before the motor starts (a longer time can be set in the code)

* From 5 seconds to go before the motor starts there are 5 audible beeps - 5, 4, 3, 2 are short beeps and at 1 second to go a long beep (number of beeps can be customized in the code)

* It's advisable to have a switch on the model to switch on/off the power setup - this would allow for an easy abort at any time before launch

* At the end of the timed motor run the motor simply cuts - 12/11/2018 - 15 seconds before the motor cuts, there are 5 momentary cuts to the motor to indicate the motor run is soon to end (this time period can be customized in the code)

At the heart of the code is something Phil had written to control a servo in the background which in this project I've used to control an esc: http://mode-zero.uk/viewtopic.php?f=41&t=57&p=751#p90 - thanks Phil for this as it works very well :)

15/05/2018 - Below is the circuit for the timer - the 6 pins circled yellow are for the USB-ASP programmer.

Arduino Based Timer Circuit
Arduino Based Timer Circuit

To build the timer, start by preparing the 8-way dip switch - look closely and you should see I have linked all the pins that go to ground. So simply bend these pins (1 to 7 only) outwards and link all 8 pins with a length of thin tinned copper wire - I did a loop round pin 1 then moved on to loop round pin 2, then pin 3, and so on to pin 8. Solder each joint and snip the excess pins off. So now the dip switch can be soldered in place as shown in the image. I doubt it's necessary, but I inserted a small piece of clear plastic to avoid a short with the board. For programming solder the two 3 pin connectors - but this is optional as some do program without them.

8-way DIP switch soldered in place
8-way DIP switch soldered in place

Next up is the buzzer (pinched from Phil's Arduino Encoder):

Orient the buzzer face down with the positive (long) pin to the top and bend the long pin to the left. Then bend a kink in the short (negative) pin. With the transistor flat side facing you and pins pointing downwards bend the outer pins as shown - left pin left - middle pin towards you - right pin right.

Bend pins on buzzer and transistor as shown
Bend pins on buzzer and transistor as shown
This image shows better the kink required on the buzzer negative pin
This image shows better the kink required on the buzzer negative pin
This image shows why a little kink on the buzzer negative pin is required - to reach the ground point on the board
This image shows why a little kink on the buzzer negative pin is required - to reach the ground point on the board
Solder the transistor to the buzzer as shown - left pin to the positive pin on the buzzer
Solder the transistor to the buzzer as shown - left pin to the positive pin on the buzzer

The buzzer can now be soldered to the board - buzzer negative (with the kink) to ground - the transistor middle pin (base) to TX0 and the right pin (collector) to VCC - bend this pin at an appropriate point to go through the VCC point on the board (I used a little piece of heat shrink to avoid shorts - see image).

Buzzer in position
Buzzer in position

Finally the connector for the esc/servo can be soldered to the board. I just found it easier to cut from a pre-made extension to get a socket with a short length of the three wires. Solder black to a ground, red to a VCC (I shared the VCC with the buzzer) and the signal wire to D10.

The code is available at the end for download. I have only bench tested at present. Anyone is free to use it for personal use at own risk. So please ensure that you fully check functionality with your setup before actual flights.

Any improvements welcome. Any problems or questions - just ask.

Carl
Attachments
Motor_Timer.ino
(5.59 KiB) Downloaded 183 times
Last edited by Carl on 12 Nov 2018, 08:22, edited 10 times in total.
Carl

------------------------------------
STILL LEARNING
------------------------------------
chlluk
Posts: 87
Joined: 19 Feb 2018, 15:38

Re: Onboard Motor Timer

Post by chlluk »

Hi
I Would very much like to use it if you can layout some details for us all.
Regards
Clive
chlluk
Posts: 87
Joined: 19 Feb 2018, 15:38

Re: Onboard Motor Timer

Post by chlluk »

Hi
What are you using as the ESC, is it a commercial unit.
Clive
User avatar
Carl
Posts: 267
Joined: 16 Feb 2018, 13:26
Location: Way down in the South West
Contact:

Re: Onboard Motor Timer

Post by Carl »

Hi Clive, I will put up some details over the weekend. I've ended up sidetracked building a second Pulstar fuselage.

Yes the esc is just a commercial one. All I do is send a max value, wait a few seconds and send a low value. This simulates max/min on the throttle stick on startup.

Carl
Carl

------------------------------------
STILL LEARNING
------------------------------------
belli
Posts: 39
Joined: 19 Feb 2018, 19:19

Re: Onboard Motor Timer

Post by belli »

Hi Carl,

I made a Free Flight timer a little while ago. It uses a PIC (12F675) on a surface mount PCB but I made the prototype on a home etched PCB. There were three version, Motor Power/Time/DT, Motor Power/Time and just DT. I am happy to post my PCB's and code if you think it will be useful to you. The motor also ramps down at the end of the run, this time is settable.

Bellisimo!

PS Maybe I should do it anyway...
PPS I realize the soddering on this one is terrible, might have been one of the first.
Attachments
FFTimer.jpg
User avatar
Carl
Posts: 267
Joined: 16 Feb 2018, 13:26
Location: Way down in the South West
Contact:

Re: Onboard Motor Timer

Post by Carl »

I've added a circuit in the first post to keep it all together.

Carl
Carl

------------------------------------
STILL LEARNING
------------------------------------
chlluk
Posts: 87
Joined: 19 Feb 2018, 15:38

Re: Onboard Motor Timer

Post by chlluk »

Hi
Is the timer script listed anywhere on the site.
Clive
User avatar
Carl
Posts: 267
Joined: 16 Feb 2018, 13:26
Location: Way down in the South West
Contact:

Re: Onboard Motor Timer

Post by Carl »

Hi Clive, I'll be uploading the last bit of information and code later today.

Carl
Carl

------------------------------------
STILL LEARNING
------------------------------------
User avatar
Carl
Posts: 267
Joined: 16 Feb 2018, 13:26
Location: Way down in the South West
Contact:

Re: Onboard Motor Timer

Post by Carl »

I've uploaded some more information on building the timer and the code. It's all in the first post.

Any questions, problems, suggestions - just post in this tread.

Carl
Carl

------------------------------------
STILL LEARNING
------------------------------------
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: Onboard Motor Timer

Post by Tobe »

Brilliant! Very well done indeed. The spirit of this forum at its best.
Cheers,

Tobe
Post Reply