PDA

View Full Version : Discussion PIC, delay and reset


ezy172
Dec 07, 2008, 03:47 PM
is it possible to connect a PIC to a servo then once reset it will move the servo arm into position (0-90 degrees) after 3 seconds then return to to its orginal position after 20 seconds? Then once reset again it will repeat?

Scehematic diagram please on how all the components are connected to the PIC.

Richard Ingram
Dec 07, 2008, 06:51 PM
Do you mean on reset move the servo from 0 degrees to 90 degrees and then after three
seconds return the servo to 0 degrees ? If this is the question then the answer is yes. A PIC can be programmed to do exactly that function. The parts count would be basically a PIC chip, a bypass capacitor, reset button and the power supply and servo leads. All the work is in the programming of the PIC.

ezy172
Dec 07, 2008, 07:32 PM
on reset it moves from 0-90 degrees after a 3 second period, then after 20 seconds return to 90-0???

what kind of PIC chip, value of capacitor/resistor......a schematic would be very helpful thanks

orraman
Dec 08, 2008, 06:27 AM
ezy127,


Download the FREE Picaxe software as per Tomapowa's posting to your previous
request for help.
Open the Programming Editor, select 08M and copy in the following simplistic program.

'Picax 08M
'sequential servo
'on GPIO 2
'IC pin 5

servo 2,100
wait 3
servo 2,200
wait 20
servo 2,100
rrr:
pause 100
goto rrr


Click on Simulate, the simulation window shows the outline and pins of the 8 pin Pic. Move your cursor over the buttons and familiarise yourself with the operations, run, reset and single step.
Click on Help, then Picaxe Manual 1 and reference the words in the program .
Click on Help, then Picaxe Manual 2 on getting started.
Click on Help, then Picaxe Manual 3, go to page 18 for the schematic where the grounds should be connected with the Picaxe and the 'pin' goes to IC pin 5. With 4.8V nicads a separate battery should not be needed.
Click on Help, then Online Support, then Active PICAXE Forum, search for any information you need, then define your needs in a logical sequence, post your questions there then make and program your gizmo.
If you can not be bothered with all that effort send me an 08M Picaxe and return postage. I will then send you the 08M that is running that program at this moment.

Dave

Richard Ingram
Dec 08, 2008, 07:24 AM
Although I have not used the Picaxe devices, I agree with orraman's solution. Depending on your programming experience an available programming software that may be the the logical approach.

Malc C
Dec 08, 2008, 12:30 PM
what kind of PIC chip, value of capacitor/resistor......a schematic would be very helpful thanks

I don't think you actually understand the concept. You have to write some code (either assembly code, basic, pascal, or many other versions) which is then converted into HEX code which you then upload to the PIC. You don't purchase a PIC from a manufacture that has these things built in.

What you are trying to do is very simple fro a PIC and you could use one of the 8 pin flash type, such as, but not limited to 12F675.

Try searching this forum for servo controller type projects using a PIC. You might be able to find something that contains sample code which could be adapted.

BushmanLA
Dec 08, 2008, 01:18 PM
I don't think you actually understand the concept.

Yeah, you have to understand that a PIC is a microcontroller and you have to write code to explain to it how to behave etc. You also need to be able to program your code into the PIC, if you don't know how to code and don't have a programmer then you might want to try another route.

Can you tell us what you are trying to do in a more general sense? Maybe there is an easier way of accomplishing your task.

Acetronics
Dec 08, 2008, 02:13 PM
Hi Bushman

From ezy previous posts I understood it's to automatically drive the landing gear of a small plane, may be a toy-plane. ( coz ... no R/C channel to drive it ... )

the problem is our friend changes its requirements at each post ...

so, ... wait and see !!!

Alain

Tomapowa
Dec 08, 2008, 02:55 PM
...

the problem is our friend changes its requirements at each post ...

Alain :confused:

That's why I finally gave up on responding to all of his similar posts/threads...

Dave... good job with the Picaxe code... hopefully we'll get more people (PIC beginners) interested in prototyping with the Picaxe. I started with the Basic Stamp years ago ($20-50), then used the Picaxe ($3-5), and now PicBasicPro for bare PICs ($1-3).

Malc C
Dec 08, 2008, 02:59 PM
the problem is our friend changes its requirements at each post ...

so, ... wait and see !!!

Alain

LOL - I'll put away my EasyPIC board :)



From ezy previous posts I understood it's to automatically drive the landing gear of a small plane, may be a toy-plane. ( coz ... no R/C channel to drive it ... )

So what he really needs is a sensor to detect the altitude of the plane, so when it > 20' it drives the servo to retract the wheel, then when it drops to <20' it lowers it..... bugger should of kept my mouth shut :)

orraman
Dec 08, 2008, 04:37 PM
Tomapowa,
Thank you for the kind words.
Picaxe Editor has moved on since you were there, with many more commands and now the simulator.
It is so well suited to radio control, no programmer, 2 resistors and a 9 pin serial socket is all.

I went with the Crownhill Proton Pic Basic, there is a Free 50 line version that covers the 12F675.

Dave

BushmanLA
Dec 08, 2008, 06:19 PM
I should start a mail order service where I can either burn PICs with the software you write or write the software for you and send you the PIC.

Judging by the posts I see here every few days it might make a few people happy.

Tomapowa
Dec 08, 2008, 06:45 PM
I should start a mail order service where I can either burn PICs with the software you write or write the software for you and send you the PIC.

Judging by the posts I see here every few days it might make a few people happy.

I tend to do a little freelancing on projects like this when I have spare time, writing code & burning pics for crazy unheard-of prototype projects. Trust me though, you won't get rich off of it unless you get follow-on work from such prototypes. The good side of doing stuff like this though is that the person you help usually can't thank you enough, making you often feel like you've done a real good deed! I also volunteer my services in local high schools who are affiliated with FIRST ("For Inspiration and Recognition of Science and Technology.", http://www.usfirst.org/ ) and I get so much out of teaching the kids how to think logically, write simple programs (using Stamps, Picaxes and PICs), program microcontrollers and then watch them work their magic. I should be paying THEM... because I think I get more out of it than they do! I only wish more people would volunteer and mentor our young potential engineers! (sorry... I seem to have gotten off the subject a bit... I"ll stop now ;) )

Acetronics
Dec 09, 2008, 04:03 AM
Hi, All

This morning I had little time to spend on the Web ...

Looks our Friend has BOMBED a lot of forums with those questions ... ( Hi, Lukus102 ... between others !!! )

...

Alain

orangepeal
Dec 09, 2008, 07:21 PM
So what he really needs is a sensor to detect the altitude of the plane, so when it > 20' it drives the servo to retract the wheel, then when it drops to <20' it lowers it..... bugger should of kept my mouth shut :)


Now you have piqued my interest! I have been flying for about 6 months now (from supercub to T28 Trojan) and I have a couple of planes on the xmas list I recently gave to my wife that might be suitable for retracts. During that same period, I've been dabbling in electronics (made a PIC based altimeter for a model rocket, a PIC based electronic die roll generator and a PIC based mood light using RGB LEDs). I use a simple PICkit 1 Flash Starter Kit to program the chips.

I recently got an Eagle Tree Systems altimeter that plugs in the accessory slot on the receiver and records the highest altitude of a flight. You can check it out here: http://www.eagletreesystems.com/press/air-alt-microsensor-v3.pdf. I highly recommend it.

Do you think it would be possible to interface this altimeter design with a PIC based circuit to drive the retract servo as you suggest, based upon altitude?

Malc C
Dec 10, 2008, 01:18 PM
Do you think it would be possible to interface this altimeter design with a PIC based circuit to drive the retract servo as you suggest, based upon altitude?

Without knowing exactly how it works its a bit hard to say. You would need to know if there is a live data output from the pins that connect to their logger unit mentioned in the text. If so, and the protocol is standard then you could use a PIC to read that live data and activate a servo at a designated height. However if the device stores the info and then transmits it like a download to the logger then it won't work.

Might be worth dropping the manufactures a line and make the suggestion, they might incorporate it in a future revision

orangepeal
Dec 10, 2008, 06:05 PM
Might be worth dropping the manufactures a line and make the suggestion, they might incorporate it in a future revision

Agreed. I just emailed them. I'll let you know how they respond. I note that this particular altimeter doesn't start to record the altitude attained until an altitude of at least 60 feet is reached. I wonder if it just isn't sensitive enough to pick up the relatively small changes in altitude necessary to automatically activate landing gear at a height somewhat to scale.

Tomapowa
Dec 10, 2008, 06:10 PM
I believe Eagletree sensors use a daisy-chained I2C interface. More info here:
http://www.rcgroups.com/forums/showthread.php?t=652526

These are also cool pressure sensors a friend of mine has successfully incorporated into some of his projects:

http://www.futurlec.com/Pressure_Sensors.shtml

Easy to interface to and are fairly accurate.

airplanebuilder
Dec 11, 2008, 12:30 AM
It's the whole thing. The book even explains how to dit yourself. I got one.

airplanebuilder
Dec 11, 2008, 12:31 AM
RADIO SHaCk

orangepeal
Dec 11, 2008, 02:54 PM
I heard back from Eagle Tree Systems regarding the altimeter. Here was their response:

Hi Ed,

Thanks for your email, and I'm glad to hear you're enjoying the altimeter!
Unfortunately, we do not have documentation for the protocol of the
altimeter sensor available. I have forwarded your email onto to our product
development as a feature request, so that they're aware this is something
people are interested in.

Regards,
William MacMillan
Eagle Tree Systems, LLC
http://www.eagletreesystems.com
Ph: 360-544-8543
Fax: 425-484-4131

orangepeal
Dec 11, 2008, 02:58 PM
It's the whole thing. The book even explains how to dit yourself. I got one.


No doubt, a basic stamp would work as well, but they are about 40x more expensive than a simple PIC microchip would be (not to mention a great deal larger) and we would still have the same issue about whether we could use the existing altimeter as a source for the data necessary to trigger the gear servo. It's possible that Parrallax has a ready-made sensor that would easily interface with the basic stamp controller to provide the necessary data--does the book say anything about that?