Another useful Python script. Divides text of bits into 8 bits at a time, so you can see everything byte by byte.
Python Code:
>>> string = raw_input('String = ')
String = 1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>>> " ".join(string[i:i+16] for i in range(0,len(string),16))
'1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
Thanks Keith and #python IRC
Main Site
Friday, October 2, 2009
Reverse Text in Python
I've been doing a lot of work lately dealing with bits, and many times I've had to reverse the bit text in order to actually see what was being submitted ( most significant bits are first not last). I used to do it by hand, but I now use a handy one line python script.
The raw data from my microcontroller:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1
The one line Python script :
print raw_input("Enter String to Reverse: ")[::-1]
Open up terminal and go into python. Type in that script and press enter.
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print raw_input("Enter String to Reverse: ")[::-1]
Enter String to Reverse:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1
1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The reversed code:
1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Special thanks to Keith!
The raw data from my microcontroller:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1
The one line Python script :
print raw_input("Enter String to Reverse: ")[::-1]
Open up terminal and go into python. Type in that script and press enter.
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print raw_input("Enter String to Reverse: ")[::-1]
Enter String to Reverse:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1
1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The reversed code:
1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Special thanks to Keith!
Wednesday, September 30, 2009
The truth about leaving light bulbs on
A common piece of urban folklore: Its better to leave a light on than to turn it off and turn it on a half hour later. The theory is that the bulb takes more energy on startup than it takes while in regular operation.
Time to debunk this foolish folklore with some math and specifications.( for incandescent bulbs)
Cold resistance of a tungsten incandescent bulb is usually around 1/10 or 1/15 the hot resistance of the bulb.( depending on the bulb). The startup time for the bulb to get from cold resistance to hot resistance is at maximum 1/5 of a second.
So when the bulb is starting up and turning on , it has cold resistance. After the the bulb is all turned on, it now has the higher resistance.
And we all know that with great power comes great current squared times resistance, or power = current* resistance. So Power = Current^2 * Resistance.
Lets take a common incandescent bulb with the following specs:
100W power consumption
120 volt source
Hot Resistance of 150 ohms
Cold resistance of 10 ohms
Startup Time(cold to hot) of .20 seconds
So that means that during that startup time , you will spend 3.16 amps(100 = i^2 * 10) for .2 seconds . Whereas with the hot resistance you will spend 0.81 amps(100 = i^2 * 150).
So lets see: upon startup you are spending around 4 times(3.16/.81=3.9) as much energy as you would spend , but only for 1/5 of a second.
Lets solve to see how many seconds of hot current draw equals cold current draw.
3.16 amps * .2 seconds = .81 amps * X seconds
X seconds = .78 seconds
Conclusion:
It takes less than one second to compensate for that startup current "surge"! Urban myth is busted!
Time to debunk this foolish folklore with some math and specifications.( for incandescent bulbs)
Cold resistance of a tungsten incandescent bulb is usually around 1/10 or 1/15 the hot resistance of the bulb.( depending on the bulb). The startup time for the bulb to get from cold resistance to hot resistance is at maximum 1/5 of a second.
So when the bulb is starting up and turning on , it has cold resistance. After the the bulb is all turned on, it now has the higher resistance.
And we all know that with great power comes great current squared times resistance, or power = current* resistance. So Power = Current^2 * Resistance.
Lets take a common incandescent bulb with the following specs:
100W power consumption
120 volt source
Hot Resistance of 150 ohms
Cold resistance of 10 ohms
Startup Time(cold to hot) of .20 seconds
So that means that during that startup time , you will spend 3.16 amps(100 = i^2 * 10) for .2 seconds . Whereas with the hot resistance you will spend 0.81 amps(100 = i^2 * 150).
So lets see: upon startup you are spending around 4 times(3.16/.81=3.9) as much energy as you would spend , but only for 1/5 of a second.
Lets solve to see how many seconds of hot current draw equals cold current draw.
3.16 amps * .2 seconds = .81 amps * X seconds
X seconds = .78 seconds
Conclusion:
It takes less than one second to compensate for that startup current "surge"! Urban myth is busted!
Friday, August 28, 2009
Working at BugLabs
I've been working at BugLabs - buglabs.net for the past few weeks. Its been lots of fun and I got to play with a lot of cool stuff.
RFID Module I made: http://bugcommunity.com/wiki/index.php/VonHippel_RFID_Reader
I also took my bipedal robot and mounted a BugBase onto it. BugBase talks to my custom Serial Servo Controller.
RFID Module I made: http://bugcommunity.com/wiki/index.php/VonHippel_RFID_Reader
I also took my bipedal robot and mounted a BugBase onto it. BugBase talks to my custom Serial Servo Controller.
Friday, July 10, 2009
CMUcam Line Follower Tutorial
I built a vision line follower robot a couple of months ago and haven't got a chance to document it. Anyways, I wrote up some documentation today - http://www.narobo.com/robots/line_vision/line_vision.html
I have more than a dozen projects and robots to document , so expect a lot more documentation to be upload this week and next week. Also, I'll be uploading a ton of videos to youtube, most of them old stuff I've never gotten around to uploading.
Heres my Youtube Channel : http://www.youtube.com/user/Erobots
Monday, June 8, 2009
Linear Actuator Demo Video
I've been playing with linear actuator solenoids lately. They're a lot of fun and have tons of applications. Here's a quick video:
Omniwheel Robot Driving Around
I added on some L298 Motor Controllers and wired up everything. The robot is wicked fast! Have a look at this video of it driving
Thursday, June 4, 2009
Omniwheel Robot Chassis
A lot has been going on the past few months. I have dozens of articles and documents to post up about new projects, and I hope to upload them all when I'm bored and have free time.
Meanwhile, here's some photos of my omniwheel robot that I designed. It boasts 4x4 drive and holonomic motion. I should be able to get speeds of 3 ft/second with this robot. I used HDPE for material( buy at McMaster-Carr) , motors are Copal 50:1 Motors, and omniwheels are from Kornylak.
Monday, March 23, 2009
Dance robot torso finished
Sunday, March 15, 2009
New video of Line Follower!
I improved the algorithm a bit and eliminated the need for the camera to pan back and forth.
Source code and CMUcam AVR libraries will be released tomorrow.
Thursday, March 12, 2009
Fun with servos
Monday, March 2, 2009
LIne Follower following a Red Line
I finished up some coding and finally have the robot following a line!
Here's a video:
Here's a video:
Saturday, February 21, 2009
Line Follower Using Vision Update!
Finally an update on my newest line following robot. This robot has 4x4 drive and has a CMUcam and an IR rangefinder mounted on board. A spotlight and a servo assist the CMUcam. All the processing is done using the Axon microcontroller.
I wrote up my own code for controlling the CMUcam from the Axon, and I will post source code in about a week.
Here is a quick video I made of the robot tracking a red box.
I wrote up my own code for controlling the CMUcam from the Axon, and I will post source code in about a week.
Here is a quick video I made of the robot tracking a red box.
Tuesday, January 20, 2009
Speed Simulation
I wrote up a simple Javascript web application to simulate the speed of your robot compared to other well known objects ( a bike, a car, etc.). There is also a football field in the background so you can see your robot's speed in relation to a football field.
Right now the simulation only supports whole numbers and only only operates in the feet per second resolution. I will add on support for meters per second later.
Also I am 75% done with the simulation portion for slow speeds in the inches per second scale. That part has a yardstick in the background. That should be ready in a few days.
Heres the link to the simulation , just enter the speed in feet per second in the text box above
http://www.narobo.com/projects/software/speed/speed.html
,Eric
Tuesday, January 13, 2009
New Layout for Narobo.com
Just finished the new and improved layout of my main website - Narobo.com
Put in some javascript and also put up the Narobo Logo.
Put in some javascript and also put up the Narobo Logo.
Roboduino on MAKE !
The Roboduino was featured on MAKE: Blog.
http://blog.makezine.com/archive/2009/01/roboduino.html
Been busy with the Roboduino lately, so not much more updates.
I am working on a simulation to see relative speed in relation to a well know object in the background(ruler, football field, etc.) . It will be useful when you are trying to figure out relatively how fast an object should be going . I would also add other moving objects that would move alongside the object ( a car, a person running , bicycle, etc.). I plan to add text boxes to enter in speed and also checkboxes to select which objects would show up on screen.
,Eric
http://blog.makezine.com/archive/2009/01/roboduino.html
Been busy with the Roboduino lately, so not much more updates.
I am working on a simulation to see relative speed in relation to a well know object in the background(ruler, football field, etc.) . It will be useful when you are trying to figure out relatively how fast an object should be going . I would also add other moving objects that would move alongside the object ( a car, a person running , bicycle, etc.). I plan to add text boxes to enter in speed and also checkboxes to select which objects would show up on screen.
,Eric
Subscribe to:
Posts (Atom)