Servo Timer II

Moderators: PK, Moderators

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Servo Timer II

Postby air.command » Thu Jan 27, 2011 4:43 pm

Thanks for the prod PK. :D I have been busy working on the design though for the last 2 weeks, so I'll post progress of where I am up to:

- The design is mostly finalized
- about 2/3 of the documentation is written
- The all new firmware is done, and am just going through final testing. Happy to send you the source for perusal. It's even documented :)
- Had been struggling whether to add a separate ICSP connector or not, but re-arranged the circuit so that for firmware updates you disconnect the servo motor and any external trigger, and then you can use the same connector for ICSP.
- Have the design working on the breadboard
- Found all the components I need at digikey, and gone through their data sheets.
- Learned to create components in Eagle for ones that aren't in the libraries. needed to create 4 for the digikey parts.

- Now I'm working on the PCB layout.

Here is the circuit diagram so far. (Not pretty yet).
(I'm using the internal pull-ups for a lot of the inputs)

Image

The upper connector in the diagram are just pads, whereas the bottom connector is a right angle header so you can plug in the servo or an external trigger (or the ICSP cable)

I'm always happy to hear suggestions for improvement.

To explain what it does, here is a bit of an extract from the draft user manual:

Introduction

The ServoTimer II was primarily designed for parachute deployment on water rockets. The timer controls a single RC servo motor that can open a latch on the parachute door. The timer has a number of configurable parameters along with several trigger options. The timer may also be used in other applications such as staging rockets or controlling the direction of a camera. The timer is also designed to work with other flight computers or apogee detectors such as the uMAD.

Features

- 6-9V operation
- Single RC servo output
- External timer output
- Built in 2G acceleration switch
- External Wire make or break to trigger
- External 3V - 12V hi/low trigger
- configurable servo start and end positions
- 0-12 second delay selectable in 1 second increments
- Timers can be cascaded
- ICSP connector for firmware updates



Triggering the timer
The timer can be triggered in a variety of ways depending on the application.

Built in G-switch: The built in G-switch will detect a launch when the timer experiences acceleration of over 2G. Depending on the application, such as in a high vibration environment, where more than 2G detection is required or where the board cannot be oriented vertically, the built in g-switch option may not be appropriate.

Break wire: A set of contacts is available on the input connector to connect a loop of wire. Depending on the configuration, either a break in the loop will trigger the timer, or connecting the loop will trigger it. This allows the timer to be triggered by simple mechanical contacts or switches whose contacts are normally open or closed. External higher G acceleration switches can also be directly connected to this input.


External 3-12V input signal. This input is routed through an opto coupler isolating the trigger from the triggering circuitry. This allows other circuits and flight computers operating on different power supplies to trigger the timer.


Configuration:
Before using the timer in an application for the first time it needs to have the trigger condition and servo motor start and end positions configured.

Configuring the Trigger condition
To change the timer's trigger condition, with the power OFF set the rotary switch to "D" and power ON the unit. The LED should flash 3 times. Now rotate the switch to one of the following settings:

0 = Internal G-switch
1 = External trigger on Make wire
2 = External trigger on Break wire
3 = Opto input trigger on High
4 = Opto input trigger on Low

Turn the timer OFF. The value is automatically saved in the internal EEPROM. The next time the timer is turned on it will be configured with the new trigger condition.


Configuring Servo Positions

In normal operation When the timer is first turned on the servo motor moves to the start position. When the timer expires, the servo motor moves to the end position.

Due to the large variety of RC servo motors available, and because there are numerous situations in which they can be used
it is possible to set the start and end position of the servo. Up to 16 positions are possible over the range of movement of the servo motor. The timer produces timing from 0.9ms to 2.1ms which should cover most RC servo motors.

A servo that has 180 degrees of travel can be positioned in ~11 degree increments, while a servo with 90 degrees of travel can be positioned in ~5 degree increments.

Configuring Motor start Position

With the power OFF, turn the switch to the "F" position.

Turn the power on and the LED will flash once.

The servo motor will be positioned to the currently set position. If you want to retain this position, turn the timer OFF.

If you wish to change the position, turn the switch slowly until the motor reaches the desired positon.
The setting will be automatically stored in the EEPROM.

Switch the timer OFF. The new setting will be ready when the timer is turned back on.

NOTE: You should turn the switch to one of the 0-C positions after setting the motor position so that you don't accidentally enter the configuration change when the unit is powered on next time.

Configuring Motor End Position

To configure the motor end position, follow the same procedure as above but initially set the rotary switch to the "E" setting. The LED will flash 2 times.

When the motor is in the end position, turnthe power off.

Normal Operation

1. With the power OFF, set the timer to the desired delay time on the rotary switch: 0-C (0-12seconds). Note that when the switch is set in the D-F range when powering on the timer will enter configuration mode.

Setting the timer to 0 delay, allows the timer to be used with other apogee detecting sensors such as the uMAD or a barometric altimeter, so that the servo is activated as soon as apogee is detected.

0 delay is also useful when the timer is used with burn out detection sensors for activating a staging mechanism in multi stage rockets.
2. The servo motor will move to the start position.
NOTE: You can then turn the timer off again at this point. This is useful for getting the motor set in the correct position when setting up the deployment mechanism in the stowed position.

3. After 5 seconds the timer enters the ARMED state and the LED will light. In this state the timer starts monitoring the configured trigger condition.

4. When the trigger condition is met, the timer starts the delay.

5. At the end of the delay, the servo motor is moved to the end position activating the deployment mechanism.

6. The timer then enters sleep mode to conserve power.
Crop Circles: ... just a bunch of guys looking for their rockets ....

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Re: Servo Timer II

Postby air.command » Thu Mar 03, 2011 10:04 pm

Okay to add to the cacophony of servo controllers, here is the first prototype of the ServoTimer II ready for flight testing:

Image

Had a bit of trouble getting the chip programmed on the board initially but it's all good now. I've tested the timer now with several different configurations and even had the uMAD trigger it. I'll post a video of it working in the next day or so.

Next I'll make a couple more of them and then give them a good in-flight workout on several rockets.

A big thank you goes to PK for all the assistance, and practical tips. This is my first SMD project and it's definitely been a good learning experience.

- George
Crop Circles: ... just a bunch of guys looking for their rockets ....

strud
Engineer
Engineer
Posts: 912
Joined: Thu Oct 02, 2008 7:37 am
Location: Central Tablelands, NSW

Re: Servo Timer II

Postby strud » Fri Mar 04, 2011 7:26 am

Good stuff George :D

User avatar
OverTheTop
It's only money...
It's only money...
Posts: 2323
Joined: Sat Jul 21, 2007 2:20 pm
Location: Melbourne, Australia

Re: Servo Timer II

Postby OverTheTop » Fri Mar 04, 2011 11:29 am

Looks good.

I might suggest some further mounting improvements for the slide switch and G-switch. Don't rely on the soldering to hold the parts in place. Solder is not very good mechanically. Two possible ways would be to:
a) Solder a loop of tinned-copper wire over the component onto pads on the PCB
or
b) glue the components to the PCB using a CA glue like Loctite 401 or similar, with a primer of some sort. They used to have a product called "Tak Pak", which was a CA glue and a metered-mist spray primer, especially designed for use on PCBs.

Keep up the good work!
TRA #13430
L3
"Everybody's simulation model is guilty until proven innocent" (Thomas H. Lawrence 1994)

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Re: Servo Timer II

Postby air.command » Fri Mar 04, 2011 11:49 am

OverTheTop wrote:Looks good.

I might suggest some further mounting improvements for the slide switch and G-switch. Don't rely on the soldering to hold the parts in place. Solder is not very good mechanically. Two possible ways would be to:
a) Solder a loop of tinned-copper wire over the component onto pads on the PCB
or
b) glue the components to the PCB using a CA glue like Loctite 401 or similar, with a primer of some sort. They used to have a product called "Tak Pak", which was a CA glue and a metered-mist spray primer, especially designed for use on PCBs.

Keep up the good work!


Thanks for the suggestions OTT, I actually have a couple of through hole pads for the G-switch that does exactly that, a wire loop goes over the switch. you can see them on the bottom view (near top). This has worked well in the previous version. The loop is not fitted in this photo, but will be before I launch. I'm going to remove the G-switch in order to test another "poor-mans" mechanical G-switch that can also be fitted to this board.

The slide switch is a different matter though, and does feel like it could be pulled off with too much handling. I may have to go with glue for that as you suggest. It's the same slide switch the uMAD uses. I could potentially run a wire over the switch lengthways as well, but it wouldn't look very pretty.

PK: Have you guys attached the switch in any way on the uMAD?
Crop Circles: ... just a bunch of guys looking for their rockets ....

PK
...
...
Posts: 1710
Joined: Sun Jun 01, 2008 5:07 pm
Location: Perth
Contact:

Re: Servo Timer II

Postby PK » Sat Mar 05, 2011 10:04 am

air.command wrote:PK: Have you guys attached the switch in any way on the uMAD?

The switch we use on the uMAD has a metal cover with two tabs. We simply solder these to the copper fill area.
PK

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Re: Servo Timer II

Postby air.command » Sat Mar 05, 2011 4:52 pm

Here is the updated circuit diagram.

Image

I've been putting it through more testing and found a couple of issues.

The original trouble I had with the in-circuit programming also happened with the second unit. It seems that either the voltage reg or associated capacitors are somehow interfering with the programming process. The PIC programmer just doesn't recognize the chip and does not want to program it. When I cut one of the tracks so that the voltage reg is not connected to Vcc of the chip while programming and then the PIC programmer has no trouble seeing it and programs it no problem. On the second unit I installed the chip on the board without any other components, and was able to program it without issues. When I connected up the rest of the components, it would not program again. Cutting the track again solved the issue. Thinking that the two 1uF caps perhaps were at fault, I replaced them with 0.1uF ones, but still no go. (though they really need to be 1uF because of the LDO reg spec)

While it's not a major issue, it is a bit of a pain. I can put a couple of pads on the board and solder a bridge after programming (like a 0 ohm resistor) and if it ever needs an upgrade I can just take it off, program, and resolder it on.
Any suggestions what might be happening? Is it likely that the LDO voltage reg is doing something? Should I try connecting the VIN to the VOUT of the reg during programming? I also wonder whether it is just the particular PIC programmer I am using, and others may work fine.


The second issue I came across by chance while testing the timer with different types of servos. 3 out of 4 were fine. One of them though would work OK when you turned on the timer and went through the whole cycle, but when you turned the power off, and turned it back on within a few seconds, the timer would not work.

I traced it to the servo actually storing quite a charge, as after turning it off a voltage was still sitting on the power pins on the servo connector slowly decaying from about 1V. I disconnected the servo and it was still holding about 0.5V even after 10 minutes. All the other servos discharged much faster when turned off and would not cause issues with power cycling the timer.

In code I put the PIC into sleep mode after the servo activates to conserve some power, but what is likely to be happening is that the PIC never gets out of sleep mode as the servo keeps feeding it power, even after the battery is disconnected. If you wait say 20 seconds then the servo discharges and you can turn it on again without problems. I'm going to try not going into sleep mode, and see if that fixes it. I could add a 'POWER ON' LED that would quickly discharge the servo when power is turned off, but then it would drain the battery faster especially if it takes a while to find the rocket. I guess there are few other options as well.

... I'll go and do more investigations ...
Crop Circles: ... just a bunch of guys looking for their rockets ....

strud
Engineer
Engineer
Posts: 912
Joined: Thu Oct 02, 2008 7:37 am
Location: Central Tablelands, NSW

Re: Servo Timer II

Postby strud » Sat Mar 05, 2011 5:10 pm

George,

If you drop the hex switch and breakout the UART, you could use it to set the time AND program the chip with a bootloader :D

You can drop the pins needed for the ICSP and use them to replace the two you lost for the UART and have your hex switch again !

CS

PK
...
...
Posts: 1710
Joined: Sun Jun 01, 2008 5:07 pm
Location: Perth
Contact:

Re: Servo Timer II

Postby PK » Sat Mar 05, 2011 9:01 pm

I'd be interested to hear if you could program the chip in circuit with the rotary switch set to "4"

I'm assuming you don't have said servo connected when programming..
PK

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Re: Servo Timer II

Postby air.command » Sat Mar 05, 2011 9:41 pm

strud: The bootloader definitely would have it's advantages. I must look into that on the next version, as you said before it would allow people easily to upgrade their firmware without the need for a PIC programmer. Though you still need to get the bootloader on board the chip. How often have you had to reinstall the bootloader on your PIC? Or is it that stable that once it's installed you really don't need to do it again.

PK: I've just tried the position "4" programming, but still no go. Tried a few of the other positions, but also no joy. What was the reasoning for position "4"? And yes the servo is not connected while programming, as it shares the same connector as the ICSP.

--------------------------------

I've also removed the sleep mode and just replaced it with an infinite loop, and the timer power cycling issue went away with the dodgy servo. So all is good there. I also measured the current drawn by the timer.
In idle mode with LED off: 1.5mA
In idle with LED on: 6.6mA.
In Sleep mode: 0.6mA

When you connect a servo (but not running): 7.6mA
With servo connected and LED on: 12.7mA
When servo running: ~100-400mA

Since sleep mode only saved ~1mA, when you have a servo connected it's not worth really using the sleep mode. (Unless one used a FET to turn off the power to the servo. ) :wink:
Crop Circles: ... just a bunch of guys looking for their rockets ....

strud
Engineer
Engineer
Posts: 912
Joined: Thu Oct 02, 2008 7:37 am
Location: Central Tablelands, NSW

Re: Servo Timer II

Postby strud » Sat Mar 05, 2011 10:00 pm

You can simply program the bootloader into the PIC before soldering onto the board.

I haven't had one screw up yet & PK reckons he has had a very high success rate with this approach as well.

An example of a programming tool for a SOIC28 package (initial idea from PK) :

https://picasaweb.google.com/cstrudwicke/ProgrammingTooling?authkey=Gv1sRgCPTgh-GNnZnw2gE&feat=directlink

You simply drop the chip into the tool, hold down with your finger whilst programming & verifying.

CS

PK
...
...
Posts: 1710
Joined: Sun Jun 01, 2008 5:07 pm
Location: Perth
Contact:

Re: Servo Timer II

Postby PK » Sun Mar 06, 2011 8:58 am

air.command wrote:What was the reasoning for position "4"?

Its a Zen thing.


One of the classic gotchas with pics is to leave RB4 floating (or worse, pulled high) in your design.
If you have LVP enabled in your config (the factory default) then the micro will assume you're going into that mode and won't program.

Re programming adapters. We routinely have to program batches of 100 chips. I own a $200 ZIF socket for SOIC28 chips. It's nowhere near as good as the 50c adapter we made. For QTY <5 you don't even need the extra bit with the locating cutout. Just line the micro pins up with the pads, hold in place with your thumb and program.

Re bootloaders. We bootload firmware, both in the factory and in the field, over wireless links. Couldn't say how many times I've done it, but it'd be thousands. The number of failed attempts requiring conventional reprogramming of the micro (a problem for us because we pot everything) you could count on one hand. Oh, and it's always caused either by me accidentally powering down the target during a load, or by the RF link dropping out for some reason.
Use tiny bootloader, I've got VB code that you can build into an app to send it firmware.


PK

air.command
Astronaut
Astronaut
Posts: 1876
Joined: Mon May 14, 2007 11:18 am
Location: Sydney, Australia
Contact:

Re: Servo Timer II

Postby air.command » Sun Mar 06, 2011 3:22 pm

PK wrote:
air.command wrote:What was the reasoning for position "4"?

Its a Zen thing.

One of the classic gotchas with pics is to leave RB4 floating (or worse, pulled high) in your design.
If you have LVP enabled in your config (the factory default) then the micro will assume you're going into that mode and won't program.

PK


Brilliant, that was it! :D Actually I noticed that RB4 wasn't connected to the rotary switch position #4 (circuit diagram I posted wasn't very clear) RB4 is connected to the G-switch so I just shorted out the G-switch which grounds RB4 and the PIC behaved itself and was recognized and allowed itself to be programmed.

I guess we all learn these little bits of knowledge by doing things the hard way. :wink:

Here is a video of the timer at work, it shows normal operation, how to configure it, connected to the uMAD and chaining them so you can drive multiple servos for staging and parachute deployment, or drogue/main functionality etc.
(Warning: Watching video may cause drowsiness)



- George
Crop Circles: ... just a bunch of guys looking for their rockets ....

PK
...
...
Posts: 1710
Joined: Sun Jun 01, 2008 5:07 pm
Location: Perth
Contact:

Re: Servo Timer II

Postby PK » Sun Mar 06, 2011 3:41 pm

Like I said, Its a Zen thing.
be as one with your micro.

You've probably worked this out already, but disable LVP in the config and you'll never have to worry about shorting the G switch out again.
Unless you erase the chip of course.

I guess we all learn these little bits of knowledge by doing things the hard way. :wink:

And how! I'm going through one of those insane, day long, debug one stupid thing, I'm gonna flush the F&#KING THING down the dunny! processes today..
The trick is to stay calm and be as one with the micro.... <inhale>.....whoooshkaaaaaah...

PK

PK
...
...
Posts: 1710
Joined: Sun Jun 01, 2008 5:07 pm
Location: Perth
Contact:

Re: Servo Timer II

Postby PK » Sun Mar 06, 2011 3:49 pm

One question. What's the rationale behind having to select a particular type of trigger?
Could you not just look for any of them?

PK


Return to “Whooshtronics”

Who is online

Users browsing this forum: No registered users and 2 guests