Show Posts
Pages: [1] 2 3 ... 376
1  Topics / Robotics / Re: VACUUM ROBOT on: August 28, 2014, 11:34:21 pm
because any flaw in wheel spin or not doing what it thinks it's doing

Guess what: In any such system you are always going to have error - error in the output, error from the sensors - error everywhere.

If you want to have any hope of making the robot navigate properly within a certain level of probability of being in the proper location where it thinks it is (but only within a certain level of error - mind you!) - then you need to be thinking in this manner.

The problem, though, is that it is very difficult (but possible) to build a robot that navigates in such a manner. The main concept is known as SLAM (Simultaneous Localization and Mapping - google it), and there are as many possible solutions and algorithms as you could care to investigate (some are sized for small processing systems, others for much larger systems). Despite what you may read or see as you research, SLAM can be implemented as an outbound, on-board sensor system (think on-board the robot chassis LIDAR, ultrasonic sensors, cameras, etc) or an inbound, off-board beacon or sensor system (think cameras looking in on where the robot is, or IR beacons, or ultrasonic beacons, etc). Most SLAM discussion, though, focuses on sensors located on the chassis of the robot - so keep that in mind.

The process is difficult to understand, and more difficult to implement - but it is at the heart of the most advanced robot navigational systems being researched and implemented. That said, you don't see such things on robot vacuums, because they are so difficult to implement well, and that costs money, lowering profits (well - not completely true - I suspect that the Neato XV series use some form of simple SLAM or something real close). Instead, you get the typical random walk and edge following behavior such as the Roomba uses. Much simpler to implement, and the parts are inexpensive (which translates into larger profits).
2  Using Arduino / Motors, Mechanics, and Power / Re: Arduino + h bridge l298n + dc motors, robot move a litle and then gets crazy on: August 28, 2014, 11:23:19 pm
Also realize that the L298 drops a couple of volts from the supply - so your 4.8 - 6 volt supply (not sure what kind of batteries you are using) could be as low as 2.8 - 4 volts by the time it gets to the motors...
3  Topics / Robotics / Re: OV7670 sketch??? Please help me! on: August 26, 2014, 11:55:38 pm
Are you ignorant about Google?

If you go to Google (, and you type in "OV7670" - you should get a ton of hits (for me 348,000 hits appeared).

Now - for me, the third link down was this link to the Arduino forum from 2012:,125767.0.html

If you review the links google gives you (especially the links to various datasheets - along with code for a variety of platforms other than the Arduino - which you can reference to validate whatever code you come up with -for- the Arduino) - and the links in that Arduino forum thread, you should be able to find more than a few potentially working (??? - unknown, I have not tried any of the code personally) examples - at least more than enough to get started.

But - before all of that - perhaps you need to take some time in learning how to perform Google searches, proper search terms to maximize relevant results, etc - before you start down this road with the OV7670 camera - simply because if you were unable to get this far, and were unable to use Google for some reason, you will likely hit another stumbling block which could be answered fairly quickly - sooner, rather than later.

Good luck - the world is counting on you!
4  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 25, 2014, 12:06:00 am
The thread that liudr posted is the right thread - page 2 has a link to a different forum post about a descriptive implementation I created:

Right below it (next comment after mine above) is a code implementation of the idea - the guy says it worked great.

I don't know if the code on page 3 of the thread liudr posted works, but I will give him the benefit of the doubt that it does...
5  Topics / Robotics / Re: Robot Surveillance Car on: August 23, 2014, 04:13:57 pm
If you have a wireless router available, you might use an arduino with an ethernet shield to make a basic routerbot setup like below.

If you have a wireless router available, and it is a model that will support OpenWRT or DD-WRT (or other open-source firmware) - you might be able to use it directly without an ethernet shield.

Some routers that can use such open firmware usually have a serial port (generally running at 3.3v TTL) on-board that can be directly connected to the Arduino RX/TX pins (plus ground); from there, it's not too difficult to begin controlling the Arduino (especially if the Arduino is running Firmata or similar software).

Some routers will have USB ports - which are usually used for hooking up USB drives (external hard drives and thumb drives) - to act as a simplified NAS device on the home network for sharing files. As such, they are effectively host controllers, and the open-source firmware can be set up to use those ports as virtual serial ports - just plug the Arduino in, and again - communicate with them via serial USB.

Sometimes you can hook up a USB hub to the port to gain more USB ports (plus extra current capability if needed); doing this would allow you to connect up a cheap web camera and other devices (like a GPS unit, or maybe a USB servo controller - just a couple of options that might be useful for the OP's needs - though most of that could be run thru the Arduino anyhow). Or you could simply use a wifi or hard-wired ethernet IP camera if you have one lying around.

On ebay is sold a cheap "travel router" called the TP Link TL-WR703N - goes for about $20.00 USD and is supported by Open WRT:

It's got quite a lot going for it - you can hack it to add extra USB ports, add a flash thumb drive (for more storage space for firmware OS extensions), add an external antenna, etc. Depending on your wants, needs, abilities and finances, one of those coupled to an Arduino would make a really nice system that would potentially be much cheaper (and more expandable) than an ethernet or wifi shield.

If you can't afford that, you can typically find old Linksys WRT54G routers (only certain models and versions are supported by the various open-source firmware distros available - so be sure to check that before you buy) at a thrift store. I've seen them sold at such places for under $10.00 USD usually. They aren't good for home network use, but for interfacing purposes (with open firmware) they are really useful.

Earlier today I purchased a Netgear WNR2000v3 - while it doesn't have USB support, it does have plenty of memory for a lot of options, is supported by OpenWRT and DD-WRT, it has a serial port easily accessible, and while I didn't see anybody who had done it - in theory it should be possible to add an external antenna (most of the time you just need to solder on a pigtail to SMA adaptor and you're done). It was half-price Saturday, so I got it for $7.50 USD.
6  Community / Bar Sport / Re: Why Q for transistors? on: August 22, 2014, 10:43:14 pm
This thread has some interesting info:
7  Topics / Robotics / Re: Robot Surveillance Car on: August 22, 2014, 10:33:04 pm
One option you can do (though it takes more than an Arduino) - is to control the Arduino with a Raspberry Pi (or similar small form-factor computer) on board the vehicle.

The purpose of using such a device is:

1) More powerful machine for hosting a web page and server system
2) Easy to connect to the Arduino
3) Easy to connect many kinds of USB web cameras

So - you basically use the Arduino to control the motors and the pan/tilt servos - set up the Arduino with Firmata - virtually no other coding is needed for the Arduino.

Then on the Pi, install Node.js and write a simple web-form application to grab info from the video stream and plug it on a page, as well as take user input and output the needed actions to the serial port to Firmata (via one of many extensions available for Node.js - a popular and powerful one is called "Johnny Five").

Then all you need to do is have that Node.js script run, then point a browser at it (like the browser on your phone) - and you'll be able to see the streamed video and control the robot platform via the web form.

Now you may wonder "why do I need the Arduino at all - after all, the Pi has GPIO pins?" - which is a very valid question. The best thing I can say is that since the Pi is single threaded, you gain by splitting the processing power up - the Pi can command the Arduino, then continue processing as needed (without waiting or consuming other resources. The other advantage you get with this arrangement is not having to worry about level-shifting of the GPIO pins (the Pi uses 3.3 volt TTL  logic - whereas the Uno and most other Arduinos - but not all - use 5 volt TTL logic). You also protect the Pi from damage on the GPIO as well.

Also - I realize that all of the above is very brief, and may well be over your head. If it is, take it one step at a time. First just get Firmata installed on your Arduino, and learn how to use it (via a serial terminal) to control the actions of the robot (pan/tilt and movement). Then work on learning how to set up and use the Raspberry Pi (including how to hook up and use a web camera).

Then learn how to code using Node.js (tons of great tutorials out there). Once you have that, you should be able to connect to Firmata using Node.js and one of the extensions.
8  Using Arduino / Project Guidance / Re: Robotic arm, need help with servo movement on: August 22, 2014, 10:20:08 pm
I want the servos to move smoothly so the arm doesn't wobble when the high torque servos jerk from on position to the next. I'm looking for smooth natural movement.

That's a nice looking robot arm, btw.

Something you'll probably want to do is a "ramp-up...ramp-down" on the speed of the servos. So - each time thru the loop as you increase the servo speed, increase the "distance" between the amounts you set, until you reach a fixed upper bound.

The below is rough pseudo-code - but it should illustrate the idea I am meaning:

from = 10; // start position of servo
to = 120; // end position of servo

min = 1; // minimum acceleration
max = 10; // maximum acceleration

rdpos = 0; // ramp down position

pos = from; // start the servo at this position
ai = 1; // acceleration incrementor starting value
ac = 1; // acceleration constant


      if pos >= to then exit loop; // reached the end of movement

      pos = pos + ai; // accelerate the positioning of the servo

      ai = ai + ac; // increment the acceleration incrementor by the acceleration constant (see note below)

      if ai > max then
           ai = max; // bounds check for max acceleration
           rdpos = to - (pos - from); // position at which to start ramping down

      if ai < min then ai = min; // bounds check for min acceleration

      if pos >= rdpos then
           ai = -ai; // invert acceleration to slow down servo until done
           ac = -ac;

Ok - the above code is -completely- untested, and it also only allows for positive directional movement of the servo (that is, from a position smaller relative to the end position) - it will likely need to be debugged and then generalized to allow for movement in the opposite direction.

Note: You might want to only increment the incrementor every "n" times (where n is some integer) thru the loop, in order to make the ramp up and down less abrupt. Alternatively, one could imagine where most of these values are floats of some sort, and only when the servo.write() is performed do you cast the value to an integer.

However you perform the ramp-up/ramp-down for the acceleration curve - the point is to do something like this; ideally, doing so will make the movements smoother and more fluid, and allow the mass being moved to come up naturally to speed, instead of forcing it to move at full speed (which results in the jerkiness you have experienced).
9  Topics / Robotics / Re: Recommendations Needed: Hardware Suppliers on: August 17, 2014, 02:21:34 pm
Depending on where you are at on the west coast, be sure to check out surplus suppliers and "industrial junk yards" as well.

Especially if you are in or near the San Jose area of California! The Los Angeles area also has more than a few. Just be sure to wear old clothes and expect to get a bit grubby (for certain places, it is advisable to bring gloves and boots - especially if it has an outdoor yard).

Realize that retail outlets as have been offered - while great places to get exactly what you need - will in the end cost more than a bit of cash. For instance, Servo City has a great robotics construction system - but it doesn't come cheap once you go beyond simple constructions.

In general, if you need to keep within a budget - using raw materials (plastics and metals) - as well as surplus parts, then machining and fitting everything together yourself with whatever tools you have on hand will ultimately be a lower cost method (although the time/money factoring can come into play here as well - as you'll be doing a lot more work to get things working properly than had you used pre-machined and standardized components).
10  Using Arduino / Motors, Mechanics, and Power / Re: dc motors without arduino motor shield on: August 17, 2014, 02:12:32 pm
...and there's your lone 9V transistor battery.

Not only that, but those tiny hobby motors are directly connected to the wheels with no discernible gearing whatsoever!


If you want this to work (and it can!) - the first thing you need to do is position some kind of gearing mechanism between the motor and the wheels. Even it is just some pulleys and rubber-bands, that will be better than nothing.

Indeed, a simple rubber band around the outside of the wheel and using the shaft of the motor (maybe with a pencil eraser as a small pulley) should be enough of a gear reduction to get you the torque you need. Shift the motors forward of the wheels, put the wheels on an axle (so they can rotate freely and independently of each other, of course).

Secondly - drop the use of that small transistor battery as everyone else here has noted, and use a proper battery pack to power the motors. Your 9V can still power the Arduino (not ideal, but it will work) - if you have things hooked up in that manner.
11  Using Arduino / Project Guidance / Re: Image processing from arduino UNO on: August 17, 2014, 01:57:00 pm
Can u please let me knaow the devices that are better than it? I am recommended to use a camera

Yeah - but were you recommended to use a serial JPEG camera (coupled to an Arduino)? If you were, then whoever told you this knew less than you.

Now - I can imagine a scenario which could -possibly- work with an Arduino, using a camera - to tell wind speed and direction. But it wouldn't be easy to implement:

1. First off the camera would need to be a standard composite output camera, ideally with no IR filter.

2. Solder some thin gauge insulated wires to an IR LED; drill a hole through a ping-pong ball, and thread the wire through the ball, leaving the LED sticking out so that it points down, and the wire extends upward - like a pendulum. You might want to add a small amount of weight to the ping-pong ball by using clay or something similar (the amount will need to be experimented with).

3. Build a structure such that the ping-pong ball and LED can be hung from. Make sure that the supports are narrow enough to not deflect much wind - a tripod-type structure made from stiff piano wire (or something similar) would likely be best. It needs to allow the wind to pass on all sides, and can be anchored so that the wind doesn't carry it away.

4. Now, when the wind blows, the ping-pong ball should catch it, and deflect (swing) in the opposite direction of the wind, proportional to the force/speed of the wind. The LED will move by the same amount, since it is attached to the same.

Now - if you are with me so far - it should be obvious that if you were able to look up at the ping-pong ball from below this contraption, you would be able to see the LED move in a 2-axis manner, which would give you enough information to tell direction of the wind and speed from deflection. Again, you would need to experiment with the amount of weight on the ball so that it would move properly, yet return to vertical (or the center) when the wind died down. There's also the question of random movements and such that I won't address (suffice to say, though, that this whole thing I am describing will need some experimentation - and really might not work at all!).

5. So - we need something to "look up" at the LED from the bottom. That is where the composite camera comes in! Mount one (sans the IR blocking filter that some cameras have) pointing up, so that the ping-pong ball (and IR LED) is in the center of the frame of the camera's view (use a TV or something to center it). Once that is done, add a IR pass filter (a piece of exposed and developed 35 mm film can work perfectly for this - just a piece of the leader of the film from a developed roll will be OK) over the camera lens to cut out any ambient light; we only want to see IR on the camera.

Now - when the IR LED is turned on, it should appear somewhat in the center of the camera's view (on a TV) - a somewhat bright white "dot" in the middle of a mostly dark (or completely black) frame/image. That dot's movement is what needs to be detected.

Enter in an IC called the LM1881 Video Sync Separator:

It's a very simple chip that can be used - in combination with our composite camera - to know where and when the sync timing signals occur from the camera's output, and from that be able to tell the position of the output from the camera when we see a signal from the camera - which mostly will be black - with one bright "blip" on it. Such a system we know already will work with an Arduino - because it exists as a shield:

Now - in theory you might be able to use the above shield to do what I am about to discuss, but it might be better not to; it's likely as not you would need to modify the shield anyhow (but maybe not...).

What you will be doing is looking (in the code) for that point of light, to be able to calculate it's deflection from the center of the image (which if you pretend is 0,0 on the Cartesian coordinate system, using some offsets and some simple trig you can figure out the angle and the distance from the center). Another article which might be helpful, that uses the same LM1881 (in this case, for a laser distance sensor):

Something to keep in mind is that the faster you can run your code, the greater the resolution you'll be able to discern; the Video Experimenter board uses a modified version of the TVOut library - as such, it is designed to put it's data from the camera into a memory buffer stored in SRAM, where it can then be operated on as a whole. For your purposes, this is both unnecessary and too slow. Instead, you will simply want to use the system to note when you see the "blip" and where (X/Y) you saw it. So - while some of the code that the VE uses will be useful (and you'll need a good understanding of how it works as well) - most of it is superfluous to your needs. Also - you will likely want your code to be as tight and efficient as possible - again, speed means more resolution (heck, maybe you could re-clock your Arduino @ 20 MHz as well).

I won't go any further on the above idea - it is more to show you and give you an idea on what is possible using a camera as you have defined the problem. Honestly, I would have to side with others on this that there are other more standard ways to easily measure wind speed and direction that have nothing to do with a camera. Even with the constraint of no moving parts, I would be willing to bet that you could devise a method to measure wind speed and direction that didn't require the use of a camera. Your main limitation here - in regards to the use of a camera (whether it is the serial JPEG camera you already have, or some other camera) - is honestly the Arduino. It isn't the right platform for the purpose at hand, because of its limitations in speed and memory.
12  Community / Bar Sport / Re: What Faggot means in the UK on: August 13, 2014, 10:56:19 pm
Coming into this late, too - but I'm actually concerned as to what a "west country sauce" is. Looks like brown gravy to me - but something tells me that, because it is Britain, I am terribly WRONG.
13  Using Arduino / Sensors / Re: 12 daisy chained SN74HC165N on: August 13, 2014, 10:52:42 pm
Ok thanks. I'll try that. It worked well with 4 shift registers. So I think I would just need to store the bits in an array of 3 unsigned long variables?

You might find it easier to parse things if you used an array of 12 bytes - one for each shift register.

Really, the best arrangement would depend on what each shift register was reading; for instance, if each register was connected to something that was providing an 8-bit value (let's say 12 potentiometers, each into an 8 bit ADC) - then an array of bytes might be best - one byte per potentiometer.

However, if the ADC were a 16 bit device (so 6 potentiometers - each ADC feeding two '165 registers) - then an array of 6 integers might be better to represent the read values.

In either case, though, three unsigned longs - while still carrying the same information - might be more difficult (or at least more obscure) to parse at a later point in the development (also, the code would become less clear as to what and how it was working - which might lead to a future maintenance headache for your future self).

By keeping your data elements logically representative of the real-world components (and values), your code will become easier to read, understand, and maintain - both as you develop your project, and when you need to maintain it in the future...
14  Using Arduino / Motors, Mechanics, and Power / Re: H-bridge on: August 13, 2014, 10:42:18 pm
I make references to actual articles, supported by Arduino under there learning section. He calls them incorrect with no references and expects us to whole heatedly assume he can't be wrong.

Grumpy was the first guy who called me out for something, on one of my very first posts on this forum back in 2009 or so. It irked me then, but I got over it, and I learned an important lesson (always define your acronyms before you use them - that way people understand what you are talking about).

Needless to say, I trust Mike's judgement - he has proven his worth and knowledge are immense over the years. Yes, sometimes he goes off on a tear - we all have bad and/or "off" days. But that's his charm; I always hope that someday he and I could go for a pint at a local pub - he seems like someone worth getting to know better. But I digress...

As far as the Arduino site's learning tutorials? Above all, I have learned to take most of them with a "grain of salt" over anything Mike says. Indeed, between the known errors in both the documentation of the Arduino, the references, and the learning examples - none of which ever seemingly get fixed (then again, I don't constantly check them - but I am certain there are documentation bugs still out there which have been there since the beginning). It's kind of like the extra 0.5 inch header offset, which is also a bug in the design due to an admitted 11th hour "too-tired-to-be-working-on-this-but-gotta-get-it-out" mistake made by the founder. Always been there, not going to change now - even if it would help the project overall.
15  Using Arduino / Motors, Mechanics, and Power / Re: proplem in DC motor on: August 13, 2014, 10:30:54 pm
can this motor move left and right and if he can how i can do this

I'm going to try to be a bit more helpful...

You can't do much with just the motor and the Arduino - you need some way to change the direction of current flow thru the motor. What you need is called an "h-bridge":

Now - according to this (data about your motor):

Under "no-load" conditions, the motor will draw 190 mA of current. Unfortunately it doesn't say how much current it will draw when stalled (which is the condition when the motor starts up - not just with a load that the motor can't move, though that is the traditional meaning of the word "stall") - but you can guesstimate about 5 times or so of the "no-load" current, or about 1 amp in this case.

You want an h-bridge that can handle this amount of current - not the "no-load" current. You will also need a power source that can provide that much current to the motor, at the necessary voltage.

Now - I know that the specs say the motor requires about 4.5 volts to run; in reality these small motors can take a bit more, with maybe a little decrease in life. The thing is, commonly available h-bridges that you can typically purchase inexpensively (I'm talking L293 and L298 based h-bridges) tend to require more than that to run the motor - but they also tend to consume a couple of volts as well. So - if you can supply about 7 volts through one of those h-bridges, you'll be good.

As an example of those kinds of h-bridges (note - I have no connection to any vendor - just pulling an example):



If you purchase either of those - be sure to download the datasheets for the L293 or L298 IC so you can understand how it works better.

As for your voltage source - since you need about 7 volts - use a 7.2 volt RC battery pack - like:

Note that you'll need a special charger to charge the battery before your first use of it, so that will factor into the cost. You could try to build a battery pack if you wanted - using AA batteries and a holder; 6 alkalines will get you a 9 volt pack, and you can tap off at the 5 battery point for 7.5 volts (use the full 9 volts into the barrel jack of the Arduino to power the Arduino).

Alternatively, Pololu has some capable h-bridges that are more efficient; in that case, you could probably get away with a 4 cell AA pack (6 volts on alkalines):

That's one (and probably the best) example they sell.

Code for driving these is very simple - but I'll leave that as an exercise for you to research and/or experiment with. Suffice to say, now that you know the circuit is called an "h-bridge" - you should be able to google something to find examples fairly easily.

Good luck with your project.
Pages: [1] 2 3 ... 376