Posts

Showing posts with the label Servo

Adding an analog feedback tap to a 9g Micro Servo

Image
Internally the servo has a feedback loop that is driven off of a variable resistor.  The resistance value changes as the servo sweeps across its range of motion. This can act as a proxy for the servo's position.  You can buy servos with an extra wire that exposes the voltage across that variable resistor or you can make your own. Or, you can add your own sensing wire to the potentiometer. I have a bunch of the 9g micro servos for various projects.  The one below has an extra green wire coming out of it that is connected to an analog input on this ESP32 C3.  The ESP32 can see  the location of the servo while it is in motion. See the Video on YouTube Sample Program Output The checksweep.py  program in this GitHub repository FreemanSoft ESP Python   The sample MicroPython tester moves a servo from 0 degrees to 180 degrees in steps and then returns to 0 degrees.  It logs the analog value of the potentiometer at the end of every move. It is actually...

Servo Pulse Width Modulation PWM and Timer Resolution for 1ms-2ms and 600us-2300us

Image
I moved an app from an ESP8266 to a Raspberry Pi Pico processor and none of my servos worked correctly. The servos moved but not the right amount.  Then I google-found someone that had given a completely different set of microsecond ranges.  It turns out they fixed the problem but did not understand why they had the problem.  The following type of explanation is not correct The setServoCycle(position) function can be used to set the position of the servo by passing the position parameter from 1000 to 9000. The values for duty_u16 are in microseconds instead of degrees. The servo values 1000-9000 represent 0-180 degrees Servo control is based on Pulse Width Modulation where the width of a pulse tells the servo its position.  The control pulse is between 1-2 msec in a 50hz cycle.  That 50hz translates into a 20msec period.  So basically the control pulse ranges from 5%-10% of the period.  That translates to 1000usec - 2000usec .  Servos are ...

Aruino + Servo + Ikea Dekad = Freemometer

Image
After some group success with the Continuous Integration build lights, I wanted an "extreme feedback"  way to graphically show our production traffic either through transaction metrics or through server utilization. People understand gauges and alarms so I wanted to incorporate both of those features into some type of device. The end result is a USB controlled dial gauge with real alarm bells and a single red/green LED status light. The total build cost about $53. It contains a text command console that accepts ASCII strings over the COM port.  The command console extends control over the LED, the servo motor and the bell motor to the connected host.  Hardware Design I know how to do the basic electronics but nice packaging has always been a problem. Ikea came to the rescue here with the $7.00 Dekad alarm clock with a metal case and alarm bells with an external hammer. The case is pretty good size was originally made for their wind up clock. It i...