Monday, March 21, 2011
HAC-US radios are a pain. Need to try just transmitting something since the setting mode isn't working right. The settings for the Arduino and the radios for data are different--serial data usually has a "stop" or "start" bit, which tells the machine the end of the byte. Means changing the arduino's settings to try to get it working.
Sunday, August 22, 2010
hypernext
I lied. This post will be on GUIs, specifically how I plan to make them, at least at first.
The Bolo is useless without a way to give it detailed data--routes, target verification, etc.--and to receive data--maps, target info, etc.. A command prompt is going to be useless for this, since some of it is picture and video data. This means a graphic user interface is needed, to organize controls and displays so they can be used effectively. It also needs to be stand-alone--I can't be opening a programming IDE just to work with the Bolo for general purposes.
Until I find a decent system for building a reasonablt powerful interface in C++ or soemthing, a much more practical system will be needed. After looking a bit, I've decided to use Hypernext.
Those that grew up in the late 80s and early 90s might remember a program on the Macs of the age, Hypercard. Hypernext is the next generation, and is cross platform. So, "Mousebot," formerly "Frankenbot," and predecessor of the Mk I Bolo, will be using this for the computer interface and processing. It should be able to get fairly sophisticated, as it's tied in with REALBasic, an object oriented Basic language. So, I'll get to learn that too, and maybe the setup will be used for the first Bolos as well.
The Bolo is useless without a way to give it detailed data--routes, target verification, etc.--and to receive data--maps, target info, etc.. A command prompt is going to be useless for this, since some of it is picture and video data. This means a graphic user interface is needed, to organize controls and displays so they can be used effectively. It also needs to be stand-alone--I can't be opening a programming IDE just to work with the Bolo for general purposes.
Until I find a decent system for building a reasonablt powerful interface in C++ or soemthing, a much more practical system will be needed. After looking a bit, I've decided to use Hypernext.
Those that grew up in the late 80s and early 90s might remember a program on the Macs of the age, Hypercard. Hypernext is the next generation, and is cross platform. So, "Mousebot," formerly "Frankenbot," and predecessor of the Mk I Bolo, will be using this for the computer interface and processing. It should be able to get fairly sophisticated, as it's tied in with REALBasic, an object oriented Basic language. So, I'll get to learn that too, and maybe the setup will be used for the first Bolos as well.
Friday, August 20, 2010
serial communications
Past few days have seen some work on interfacing the Arduino with the computer so I can read the distance sensor and check the calibration. The solarbotics IR distance sensor should, according to their documentation, be pretty close to what they mentioned. It's always good to verify this though.
The Arduino's programming environment comes with a serial monitor, which can be used to send and receive data from the USB connection, which on my Mega is port 1 out of 4. The big problem is, it has problematic limitations.
The softwareSerial library has three primary commands--write, read, and print. Read() is used to read the buffer on the chip, and take commands into the program. Write() and print() will send data from the chip, write() sends binary data, and print() sends ASCII characters. Read() takes ASCII too, and this is where the trouble starts.
Read() will only take ONE(that's 1) byte of data. That's a single character, so if you're using letters for commands, no big deal. Problem is, I'm trying to send DATA, specifically, integers for the position of a servo. An int is TWO bytes, and a single read() will only get the first. There seems to be half a dozen ways to get around this, from messing with kinds of bytes or with arrays, to what I think will be the easiest, using a string. For this, you build a loop for reading the buffer, and appending the data onto a string, which you can then use atoi on to get your integer.
Single digit integers can be done however, by simply subtracting the CHARACTER '0'(zero, since the font looks wonky) from the value passed along. Since numbers in the ASCII table start at 48(zero), this shifts everything over to where it lines up with the actual numbers. Only works for one digit though. You could also get away with typing in the character corresponding to the number you want, but that would be too much work for most.
I'm still waiting on a response to a query on getting the string library the sample I saw working, next post will either be on more serial communication, or on hooking up optical mice and getting a delta position signal off for dead reckoning.
The Arduino's programming environment comes with a serial monitor, which can be used to send and receive data from the USB connection, which on my Mega is port 1 out of 4. The big problem is, it has problematic limitations.
The softwareSerial library has three primary commands--write, read, and print. Read() is used to read the buffer on the chip, and take commands into the program. Write() and print() will send data from the chip, write() sends binary data, and print() sends ASCII characters. Read() takes ASCII too, and this is where the trouble starts.
Read() will only take ONE(that's 1) byte of data. That's a single character, so if you're using letters for commands, no big deal. Problem is, I'm trying to send DATA, specifically, integers for the position of a servo. An int is TWO bytes, and a single read() will only get the first. There seems to be half a dozen ways to get around this, from messing with kinds of bytes or with arrays, to what I think will be the easiest, using a string. For this, you build a loop for reading the buffer, and appending the data onto a string, which you can then use atoi on to get your integer.
Single digit integers can be done however, by simply subtracting the CHARACTER '0'(zero, since the font looks wonky) from the value passed along. Since numbers in the ASCII table start at 48(zero), this shifts everything over to where it lines up with the actual numbers. Only works for one digit though. You could also get away with typing in the character corresponding to the number you want, but that would be too much work for most.
I'm still waiting on a response to a query on getting the string library the sample I saw working, next post will either be on more serial communication, or on hooking up optical mice and getting a delta position signal off for dead reckoning.
Saturday, July 10, 2010
I need to put an addendum on that last post, with new stuff I've learned since then.
If you take a lead off the sensing/ground lead, and take it to an analog input pin, you'll get a voltage across the resistor if it's there. This can be used to provide feedback on how much power is being pulled by the motor, and PWM can be adjusted to provide constant current depending on the conditions.
Most people will be more worried about the speed of the motor however, which isn't consistently available through the current level. Current control can tell you if the motor is stalling, but generally if you have a reasonable method of measuring speed, you'll be able to tell the motor is stalling that way.
You don't need a resistor unless you're messing with the current sensing, but if you are, the wattage rating on the resistor needs to be selected properly(probably over a watt), and the resistance needs to be chosen to make sure the voltage being sent to your sensor pin doesn't fry it.
If you take a lead off the sensing/ground lead, and take it to an analog input pin, you'll get a voltage across the resistor if it's there. This can be used to provide feedback on how much power is being pulled by the motor, and PWM can be adjusted to provide constant current depending on the conditions.
Most people will be more worried about the speed of the motor however, which isn't consistently available through the current level. Current control can tell you if the motor is stalling, but generally if you have a reasonable method of measuring speed, you'll be able to tell the motor is stalling that way.
You don't need a resistor unless you're messing with the current sensing, but if you are, the wattage rating on the resistor needs to be selected properly(probably over a watt), and the resistance needs to be chosen to make sure the voltage being sent to your sensor pin doesn't fry it.
Friday, April 23, 2010
L298 current sensing
The L298 pulls the current from the source voltage(not to be confused with the logic voltage) supply, to the current sensing pins--NOT the main ground. The resistors that are recommended? The power to the motor/load is going through that resistor, as well as the load. If the resistor is too big, it blocks the power and the motor won't run until the voltage is high enough to overcome the resistor. I put the recommended 10 ohm resistor in, and it was keeping the motor from running. I didn't quite realize what was happening until I touched it and realized it was hot--Kirchoff's Law says that the resistor will have the same current as the motor--.6 amps in this case, which was also "letting the magic smoke" out of the resistor--9V * .6A = 5 watts, not 1/4. When I put a potentiometer on the circuit, I found that the motor would slow around 4-5 ohms, and stop at 5-6, well below the 10 ohms from before.
For future reference, unless you REALLY want to limit the current, just put the sensing contacts straight to ground. If you need the resistor for whatever reason, get a potentiometer(preferably one rated for the desired power), and adjust it to get the desired outcome. Check it with a multimeter, and you have the reistance you want. Also make sure that you have the power rating needed--most likely anything above 3-5 volts will draw more than the 1/4 watt most resistors people use for hobby electronics are rated for. Magic smoke is only fun if you're deliberately trying to get it, though resistor smoke is cheaper than L298 smoke, which I got when putting 9 instead of 5 volts on the logic supply.
For future reference, unless you REALLY want to limit the current, just put the sensing contacts straight to ground. If you need the resistor for whatever reason, get a potentiometer(preferably one rated for the desired power), and adjust it to get the desired outcome. Check it with a multimeter, and you have the reistance you want. Also make sure that you have the power rating needed--most likely anything above 3-5 volts will draw more than the 1/4 watt most resistors people use for hobby electronics are rated for. Magic smoke is only fun if you're deliberately trying to get it, though resistor smoke is cheaper than L298 smoke, which I got when putting 9 instead of 5 volts on the logic supply.
Sunday, March 28, 2010
I got an L298 with the switches for my preliminary project. I got it working tonight. The L298 is a fairly powerful motor controller--with two 2 amp channels, most robots won't need more. The two channels can be paralelled for 4 amps, and the voltage can go up to 40 volts or so. I'm not sure l298s will work for the big tank, but for the drive on the 1/16 plastic model, it'll be fine.
http://www.pyroelectro.com/tutorials/l298_control/index.html
This is the best I found in a few minutes of google to find a tutorial. Keep in mind that the L298 comes in two versions right now--an older L298N, and a newer L298NH. On the data sheet for the N, it points out a need for filter diodes on the motor feeds. The NH has these built in. Thus it will be much simpler to wire. Keep in mind that larger motors than the 6V Erector set motor I used will probably need a heat sink on the motor driver to help keep it cool.
I got the driver from http://www.taydaelectronics.com one of many electronics outlets on the web. They had the microswitches I needed for a different project for much less than others, and since they wanted a $5 minimum order, I grabbed the L298 at the same time, knowing I'll need it for the tank eventually. Electronics are like everything else, you sometimes have to shop around. A big thing about Tayda though is that they're in Thailand. If you order something, keep an eye on the shipping options, the standard will take anywhere from one to three weeks to arrive. They also have higher prices on other components--the dozens of LEDs and resistors I needed for my other project were better gotten from Mouser Electronics.
http://www.pyroelectro.com/tutorials/l298_control/index.html
This is the best I found in a few minutes of google to find a tutorial. Keep in mind that the L298 comes in two versions right now--an older L298N, and a newer L298NH. On the data sheet for the N, it points out a need for filter diodes on the motor feeds. The NH has these built in. Thus it will be much simpler to wire. Keep in mind that larger motors than the 6V Erector set motor I used will probably need a heat sink on the motor driver to help keep it cool.
I got the driver from http://www.taydaelectronics.com one of many electronics outlets on the web. They had the microswitches I needed for a different project for much less than others, and since they wanted a $5 minimum order, I grabbed the L298 at the same time, knowing I'll need it for the tank eventually. Electronics are like everything else, you sometimes have to shop around. A big thing about Tayda though is that they're in Thailand. If you order something, keep an eye on the shipping options, the standard will take anywhere from one to three weeks to arrive. They also have higher prices on other components--the dozens of LEDs and resistors I needed for my other project were better gotten from Mouser Electronics.
Friday, February 26, 2010
Got it today
The Arduino came in today. Nice little thing, I set up a braedboard and some sticky stuff to hold it while I experiment. I got a few LED blinks, then it crapped out and it can't find COM3 anymore. Anyway, picture time.
The tabs on the side are those post-it adhesive strips. They have a velcro like stuff on them, so I can attach here, or attach elsewhere. Not sure if I'll keep it exactly like this, but it's a start.
Subscribe to:
Posts (Atom)