Go Down

Topic: Servo project (Read 227 times) previous topic - next topic

Carlw9060

Hi everyone, need a little help in fine tuning code for a little project.   Willing to hire experienced coder. I'm operating a micro servo by an Arduino pro mini 8mhz via an RF receiver on a 1 cell lipo. Everything is working great. On a button press on the remote I get it to turn 90 degrees, on another press it goes 90 degrees back to 0 degrees.
I'd like to program the remote button so that I can adjust the end point of the servo throw (the open position). So maybe with a long button press I can adjust the (open) end point servo throw from say 25 degrees to 90, but closed stays at 0 degress. And a short press toggles between 0 degress and new end point (open position). It could be variable or have fixed degree positions that the long press cycles through (whatever is easier and most reliable as the RF signal my be intercepted during adjustment).
At present, the receiver end operates at 11mah which is low but if I can get it lower the better. I'm no programmer but I believe the signal pin to servo is getting detached but I think better sleep modes could be programmed in for the Arduino. I understand that the Rx will always draw power but there may be a way to cycle the power to the Rx so it only 'listens' half the time but would still 'hear' a button press.
The servo adjustment is priority though, the rest is an ideal world! Any offers for help would be very much appreciated! Or email carl. Whitaker@hotmail.co.uk
Thanks!

patduino

Hi Carl,

Can you describe the remote a little better?  It sounds like there is a single button that currently toggles the servo position (one press swings left, another press swings right).  If so, then I'm not really sure how you'll accomplish what you're asking for.

If you start adding short and long presses to the mix, how would the receiver know whether you are trying to open or close the servo or trying to set the new stop position? 

Maybe I'm not understanding it yet...

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

Carlw9060

Hi pat, yes just one button, though I have the option of 3 buttons but really need the remote to be simple. I was thinking in code you could tell any signal a second and under is to toggle and a signal a second and over is adjustment? Maybe?! You guys will know more what's possible in code I'm sure.
Or...have 1 button that adjusts the open position and another that toggles open and close. (Remembering the last open position)
But I'd really like to keep it to one button if possible. Doesn't have to be a long press, that was just an idea. Thanks carl

patduino

#3
Sep 03, 2017, 01:52 am Last Edit: Sep 03, 2017, 01:52 am by patduino
Hi Carl,

I'm curious, what does the servo control?  Knowing that might help us better understand how to control it.

How about:

1. When turned on, the system resets to the original behavior -- or it stores the desired positions in EEPROM so the system remembers the positions when powered off.

2. A 5 second pulse could put the system into a programming mode, where short pulses could nudge the servo back and forth to its new desired position.

3. A second 5 second pulse could take the system out of programming mode, where a button press of any duration (less than 5 s) would toggle the position of the servo back and forth between the programmed positions.

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

JuaniBrunero

Hi there, if you send me the code i think i can help you: juanibrunero@gmail.com

Go Up