Skip to main content

got the servos, got them working



The servos were delivered today, and I started working on them once I came back home from work. 

The initial set up I had with RPi.GPIO was... a failure. 

When connected, the servo would just twitch and continue to groan with uncertainty about where it should position itself. 

Wanting to see what it should actually do, I fired up my Arduino that's been inactive for quite some time, connected the servo and loaded up the Servo library. It worked like a charm. The difference between a real-time PWM and a soft PWM was very visible. 

For a while, I was thinking about maybe using the Arduino as the servo controller and have the Raspberry Pi just send a single high signal that would trigger the Arduino to move the servo. However, the extra size and power that would be required put me back to my senses.

I have to say I was pretty discouraged. It was probably because I was really expecting whatever I had implemented to work right off the bat. After eating a late dinner, I pushed myself to try more. 

I tried installing the WiringPi library, but after reading about it, it didn't seem much different from RPi.GPIO, so I didn't bother to use it. 

I then thought I should maybe install the Occidentalis OS that is developed by Adafruit, seeing how it comes with servo kernels. Felt like starting from scratch (at least in the Raspberry Pi side) should be a last resort option, so I decided to try to find something else. 

Finally, I landed on ServoBlaster. It relied on writing a duty cycle value to a location in the system, but it worked smoothly, and beautifully. It also did not need to constantly drive the servo a constant signal but activated only when the position was changed (with a timeout value in the initialization parameters). 

echo 5=70 > /dev/servoblaster 

The "70" is the amount of time the signal will be high. The cycles are counted by 10 us (microsecond), making the "70" 700 us, or .7 ms. This would put the servo near the 0 degree position. 

echo 5=230 > /dev/servoblaster

This would put the servo near the 180 degree position.

Had to use system calls through the os module, but once implemented, it finally works.

Comments

Popular posts from this blog

quick recollection on setting things up

If I can swear that the password is correct, then it's possible that I'm getting the ID wrong. Hadn't logged into the web server in a couple of months and was unable to SSH into it. After an hour or so, I ended up deleting the instance and recreating a clean instance (read: erasing everything). I then realized I'd been putting the wrong ID.   apt-get install sudo apt-get install Anyways, some links I visited when setting things up (pretty much a dump of whatever I copy-pasted to notes) : Raspberry Pi http://www.makeuseof.com/tag/optimize-the-power-of-your-raspberry-pi-with-raspbian/ Logging http://docs.python.org/2/howto/logging-cookbook.html Tornado - Python webserver that supports Websocket http://stackoverflow.com/questions/2924991/what-popular-webservers-have-support-for-html5-websocket http://lowpowerlab.com/blog/2013/01/17/raspberrypi-websockets-with-python-tornado/ http://stackoverflow.com/questions/11695375/tornado-identify-tra...

warming up

I still don't have all the parts I need to do what I need to do, but I started working with what I had around. I had a 4-digit 7-segment led which I had ordered previously, but for the longest time I had thought I needed additional parts to make it work. It was only today that I realized that that was not the case. Getting some help from this site , I was able to get the digits fired up: This method uses way more wires than this guy  (which uses a serial communications protocol called I^2C), but it's good to see it work. I still do want to try the less-wire led setup, as I would like to try playing around with I^2C. In addition, I had recently purchased an Arduino Pro Mini , which contains all the capabilities of the above Arduino Uno but requires pins/connections to be soldered into the board. I had attempted to solder one part of it (the serial/USB connections) a few days ago (note that this was my first attempt ever at soldering), and the USB-to-Serial interface...

chunk update: most parts printed and assembled

currently: stuff that happened are: wired the fingers added screws to necessary assemblies witnessed first failed print during this: servos haven't come yet, but once they do, we can start installing them into the hand/forearm. as always, credit to the Inmoov project.