Go Down

Topic: Help with a basic code (Read 13989 times) previous topic - next topic

whubbard

I am looking for someone to write a simple servo code.
Happy to pay a fair price.
I have now a big servo.
Freetronics eleven
I have it set up and running the sweep program well
I can pick out and change some variables and change timing and speed etc.
I desperately need help as I don't have time to create the code to do what I want
I go overseas working in a week and would like it done before I go.
I am very interested but a lot of other things are also needing to be done.
In an ideal world if someone could write the programme I would be very grateful.
My wish list would be as follows

Power comes on. The unit starts at 0 deg and stays there.  5 minutes moves to 10 deg then at 10 minutes to 20 deg, 15 minutes to 30 deg then at 20 minutes sweeps out continuous  to 45 deg and back to 30 deg, 20 deg and 10 deg back to 0 to complete the loop.
Ideally this would happen with power switching off an on with a random timer and the unit just stopping wherever it is and then starting where it left off.
Thanks for everyones input
Gratefully appreciated.
This is very interesting stuff and can't wait to get my teeth in to it and play with it. I have many applications.
Wayne

Bainesbunch

#1
May 29, 2014, 05:25 pm Last Edit: May 29, 2014, 05:45 pm by Bainesbunch Reason: 1
Hello ,

This is not difficult but one question on something that is not clear. Since you are intending to turn this on and off with a power switch and it is not staying on all the time real-time events will not be possible. The Arduino does not have a battery backed RTC and so its timers would start at zero every time it was turned on and it would have no idea about the passages of time whilst it was turned off. If the loss of real-time is not important then you can store the last known position and direction into the EEPROM and then when the next  5 minute event takes place after power up advance it from there.

I can write it for you very quickly. Do you have a budget in mind for this.

Cheers Pete.
EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

whubbard

Hi Pete
Sorry I am not so literate with this.
Does that mean that that each section (deg) gets its 5 minutes then the sweep happens every 20 minutes regardless if the power has gone off and on 1 time or ten times.
So does the servo stay where it is and when the power comes back on it just carries on or does it start from that servo spot and think that is 0 degrees so the sweep ends up being in a different spot

whubbard

My budget is just a fair price for time.

Bainesbunch

We can store the position of the servo and the direction of travel every time we move it. This can then be recalled when we power up. However since the Arduino does not know how long it is powered down for it has to assume that the next event will take place 5 minutes after power up and that this event is the next in the sequence of 0, 10,20,30,45,30,20,10,0 depending on what the last sequence position was stored in the EEPROM.

Cheers Pete.
EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

Bainesbunch

EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

whubbard

So lets say if the power stops 1 minute before the second 5 minutes then it would retime the first 5 minutes over but if the power goes off on the 6th minute it will restart on the 5th minute or second lot of 5 minutes 5 to 10 minutes before moving to the 15 minute cycle.
Have I got that right. If so that would be good.
I would have control over the timer that powers the water pump and the arduino/servo so I can make them match.
It is to sweep leaves to one end of a pond to a filter pick up and you can push them one way and they will settle some other place away from the pick up so by sweeping will keep pushing the around until they get picked up by the drain..

Bainesbunch

EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

whubbard

I can paypal you when you are done
Thanks
Wayne

Bainesbunch


I can paypal you when you are done
Thanks
Wayne


OK leave it with me for an hour

Cheers Pete.
EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

whubbard

Thanks Mate
Its 3 AM so I am off to bed will pick up in say 5 hours

Bainesbunch

#11
May 29, 2014, 07:37 pm Last Edit: May 29, 2014, 07:42 pm by Bainesbunch Reason: 1

Thanks Mate
Its 3 AM so I am off to bed will pick up in say 5 hours


OK no worries .. here is the code

Not SUPER elegant but functional.

There are some variables you will need to play with yourself to get it turning to the exact positions that you want.
They are the numbers in the array ServoPos[]

Code Attached, have fun with it.

I have PM'ed you my PayPal details.

Cheers Pete.

EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

Bainesbunch

HI Wayne,

OK so you have the code and instructions on how to install the "time" library. Now that you have it when are you planning on paying me ?

Cheers Pete.
EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

whubbard

Hi Pete
Thanks so much....!
Its 6.00 am here.
Don't worry. there will be no problem with paying at all.
As soon as this thing move back and forth I will pay but I don't want to pay to find out I have some scribble that know one can help me with. I know it wont be that but just saying.
Sorry but as stated I am a dumb ass with all this stuff and have had limited time to play given that I got your reply last night 10 minutes before having to go out to dinner but will read and decipher the first instructions now and try to load the time library.
If you can make it easier for me with clear (do this then do that) would be great.
I have to do some stuff now and will get to it soon as I can but wanted to catch you when you were awake
I f you aswer now we can do it togeather and I will pay.
You can Type "open this, Do Taht do this ) then bingo ....Cha ching....Ha!
Thanks for your understanding Mate

Bainesbunch

Hi Wayne

I sent you a personal message with the links to the full instructions here it is again in case you have missed it somehow

Here follow this link and install the "Time" library

http://arduino.cc/en/Guide/Libraries

you can find the time library here
http://playground.arduino.cc/uploads/Code/Time.zip

Cheers Pete.
EmbeddedAT .. From Concept to Prototype to Production
Electronics and firmware design and project mentoring
I do answer personal requests for help when accompanied with a PayPal receipt ;)

Go Up