Show Posts
Pages: 1 2 [3] 4 5 ... 377
31  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.
32  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.
33  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...
34  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.
35  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.
36  Using Arduino / Motors, Mechanics, and Power / Re: HELP!! I fried two Arduino Mega already. What am I doing wrong? on: August 10, 2014, 12:47:03 pm
I'm left here scratching my head over a diagram that shows "step down transformers" on the DC output of a power supply?

One is labeled "Step Down Transformer 24v to 12v" (and feeds to the Arduino barrel connector); the other is labeled "Step Down Transformer 12v to 5v" and is cascaded from the first (and feeds the motor driver).

Transformers are for AC voltages - not DC. Unless you are using something else and calling it a "transformer" (and using a transformer symbol) - trying to do so is incorrect, and you are simply feeding 24 volts (well, probably a bit less) into the Arduino.

If you are using some other component - then you need to re-draw your schematic and label the components with their proper names. Otherwise, your schematic is mostly useless to us to help us diagnose your issue.
37  Using Arduino / Project Guidance / Re: RC car hack on: August 10, 2014, 12:25:25 pm
One thing I dont know how to do is control the speed. I've used an analogWrite command which works fine but I am under the impression that I need an accelerometer for this to be accurate on different surfaces and to maintain a single speed?

Rather than an accelerometer, monitor the speed of the drive train. You can either monitor the rotations of the wheel, the output shaft, the motor shaft, or any point in between. It will really depend on your mechanical modification ability, as well as what part is easier to access and modify.

Basically, you can use either and opto-slot encoder/sensor, or a side-looking encoder/sensor. Basically, these consist of a phototransistor and an IR LED - either facing each other with a gap in the middle (slot encoder), or both pointing sideways, sometimes with a baffle in between (side-looking).

In the case of the slot encoder, a "wheel" mounted on the shaft to monitor has a bunch of slots in it, which when the pass by the sensor, alternately expose and hide the light - creating pulses that can be monitored; in the case of the side-looking encoder, the light from the IR LED is reflected by a round disk with alternating dark and light sections - again creating a pulse to be monitored.

These pulses are proportional to the speed at which the shaft is turning, obviously. Here's some links to look at:

Note that encoders don't always have to use optical means - magnets, reed-switches, hall-effect sensors - even lobed cams and microswitches all can be used for monitoring the rotation of a shaft. Also, some encoders can give you absolute position (so you know at what angle the shaft is at); this is how a hobby servo works, for instance (using a potentiometer for this).

Now for speed - here's how it works:

You set your motor speed (however you do that), and you monitor the pulses from the motor output shaft. These pulses will be proportional to the speed you have set when it is "free running" (no load). Let's say you can set the speed from 0-100 - and the number of the pulses is equal to the setting (in the real world, this will not likely happen); so if you set the speed to 100, you'll get 100 pulses out.

Obviously, if you set the motor for 100, and you are going up a hill and only get 90 pulses out - you can't do anything (because you can't make the motor go faster). That said - if you set the motor for 75, and you get fewer pulses out, then you know you have to increase the setting (say to 80 or 85), because something is bogging things down. If you are at a setting of 80 to the motor, though, and your number of pulses is 95, then you know your surface is allowing you to slip in some manner (or you are going downhill) - so drop the number of pulses.

This would be a constant monitoring and change system - it is in essence a servo feedback loop, just like an R/C servo tries to maintain a position (and a thermostat a set temperature), in this case you are using servo feedback to maintain a set speed. There are simple and complex ways to do this servo feedback and such; the simplest would be a comparator function with a percentage window to help avoid oscillation and overshoot, a more complex (or maybe most complex) would be a PID controller.

While an accelerometer could be useful in other ways (and I am not trying to discourage you from investigating it), it might be overcomplicating things where a simpler solution might work just as well.
38  Using Arduino / General Electronics / Re: Strange acting motor + servo combo! on: August 10, 2014, 01:28:53 am
I would love to have one single power supply to power the Arduino, the motor, and the servo! :p

If you want to do this right - use hobby R/C batteries. Likely the best for you would be a 9.6 volt NiMH pack, such as:

You'll also want to get a charger - best is a smart charger, like:

Don't cheap out on batteries or chargers here - and when you are charging a battery, always be around to monitor it (don't just hook it up and forget it) - this goes triple if using lithium-chemistry batteries!!!

For the servos, you will need to find out what voltage they support, but most like 4.8 - 6.0 volts. To that end, in order to run them, you need to drop the voltage from the battery to that level (DO NOT use the 5 volt output of the Arduino - it can't supply enough current). Your best bet is to use what is known as  "BEC" in the hobby R/C world (Battery Eliminator Circuit) - it's basically a voltage regulator packaged up for the R/C world:

That one will output 5 amps at 5 volts; most BECs are integrated as part of a speed-controller - you'll have to look around to find a standalone unit, but that one above should work OK. It's a switching regulator, so it is fairly efficient as well. You could run both the Arduino and your servo easily off of it (and bypass the wasteful linear regulator on the Arduino).

One other thing:

You might want to put a fuse of appropriate size in-line with the positive output of the battery, just in case of any shorts or over-current issues. Measure (or calculate) the maximum amount of current used for all of your devices at once, add the current values together, add 10 percent, then select a fuse that comes close to that value.

Doing this is cheap protection in the event you need it. The alternative can be much worse (the battery catching fire or exploding).
39  Using Arduino / General Electronics / Re: Beginner Soldering iron Choice on: August 10, 2014, 01:11:00 am
First off, stay away from that first 35 watt Weller (WP35) you posted; while I am sure it is a fine iron for certain work, it is likely way to hot for a beginner to use, and it isn't temperature controlled.

The second Weller (WLC100) you posted seems like a better bet; temperature controlled and such - it's not a bad price, either - just realize that such an iron is going to take a while to come up to temperature (about 10 minutes).

The third Weller you posted (WES51) is a much better iron - it will heat up quickly and stay at temperature properly. But on both of those Wellers, you really have no real idea what the temperature actually is, just a number on a knob.

I second Chagrin's suggestion of the "936 clone" - for example:

These are clones of a popular Hakko soldering station - they are great devices.

Also as a beginner, be sure to pick up and use leaded solder (60/40 or 63/37) - much easier to use than non-leaded, and you want every advantage you can get while learning. Make sure to get rosin-core (NOT acid-core) solder - the kind meant for electronics (acid-core is typically meant for joining metals - like pipe).

You might also want to either pick up some liquid flux or make some of your own; actually, just pick some up - then look into how to make your own once you are used to using it. For most stuff it isn't needed, but sometimes it can be helpful. Make sure the flux is for electronics (rosin-based flux). For instance:

Beyond the soldering iron, you should also invest in a tip cleaner. Whatever you do, don't use a wet sponge. While it will work, over time it will destroy the tip on your iron. You can go cheap and find a real copper scouring "pad" and stuff it into a cheap steel pipe-cap from a big-box home improvement store (it works just fine - I built one myself), or you can buy one:

Other items to consider:

Some kind of "third hand" device to hold what you are working on - these can be built (plenty of instructables out there) or bought. They typically consist of either a vice-like device or something with aligator clips. Over time you'll probably collect a few of each.

Desoldering tools (the best way to learn to solder is to de-solder stuff, and re-solder it back on - use some kind of junk electronics board) - the number of tools here seems endless - there are bulbs, pumps, desoldering braid, etc - all of it is useful, so you might as well pick it all up.

You might also want to look into a set of used dental picks - you might ask your dentist for any old ones that are no longer useful for his practice (make sure to boil them at home just in case). Such tools are useful mainly for re-work and cleanup, as well as desoldering - on thru-hole boards and parts.

When I learned to solder, it was with a cheap 25 watt pencil iron - no heat control or anything. As such, I can pretty much solder with anything, but I have found that I like a temperature controlled iron. Just realize that it isn't the tool that makes you a good solderer; practice, practice, and more practice is what will. You can easily solder with a non-temperature controlled iron (even that 35 watt Weller) - you just have to know how such an iron responds to the environment and your joints, and how to move fast and precisely - adding only the heat you need to make the joint, then moving on to the next. After all, back in the day, soldering was literally done with an iron the size of a hammer and heated with a blowtorch - granted, this was during a time when everything was point-to-point, and semiconductors didn't exist, but the point still stands.

Good luck, and enjoy your new hobby!
40  Using Arduino / Project Guidance / Re: RC car hack on: August 10, 2014, 12:45:03 am
Can you read the information on the IC's on both the transmitter and the receiver?

If you can - and you see anything like what is detailed in this "mega thread" - then you need to read that thread completely:,86883.0.html

The ICs you photographed seem to have the proper number of pins to be of the TX#/RX# chipset "family" - you have also identified some of the pins; matching those up to the pins in the various datasheets detailed in that mega thread should get you everything you need to be able to control the vehicle.

Indeed - if you read that thread closely, toward the end I put a link over to another thread (and there is a link from that thread to the "mega thread" as well) whereby an individual was playing around with having the Arduino control the IC directly using a single pin, and emulating the pulse output that is normally provided by the transmitter.

In fact, since you have both the transmitter and the receiver - you should be able to use the transmitter and identify the pin from the radio on the receiver which feeds into the IC (an oscilloscope or similar would be handy to find this) - it will be a repeating square-wave style pattern. From there, you can see what the pattern is for each function on the transmitter, and what the frequency is as well. Once you know that, you could have an Arduino emulate that pattern, and feed that pattern into the IC in lieu of the receiver - thus allowing complete control of the vehicle using only a single pin!

Again - review the thread I posted - there is a ton of information in that thread, which is better to review than to rehash again here.

41  Using Arduino / Motors, Mechanics, and Power / Re: L298 question on: August 08, 2014, 07:33:28 pm
Here's the likely datasheet for your motor:

The 30.3 volt variant is listed in the table.

The key to finding the information (sometimes) for these motors is to take the number from the markings (in your case, "MT14202C652-R2") - and start knocking off parts while googling.

Generally, manufacturers use letters to designate differences in model numbers, so to find your motor, I first struck off the "-R2" and googled it. When that didn't work, I struck off the next bit ("C652") - with that, it worked ok by googling "Pittman MT14202". Note that the model # has changed to "DC054B-2" as well.

As you can see, while it's no-load current is fairly small (190 mA), it's peak current is fairly large (11 amps!) - much too large for the L298 (at least when loaded).

Hope this helps to sort things out...
42  Using Arduino / Project Guidance / Re: Trying to source strong (and cheap) electromagnets on: August 05, 2014, 11:48:50 pm
Long shot - but rather than trying to use electromagnets - which have a permeable ferrous core (which as designed is mean to shunt the magnetic field closer to the device) - why not just use plain coils instead, with the steel ball acting as the core?

In a solenoid, the core is "pulled into" the middle/center of what is essentially an air-core coil. The same thing is done by a so-called coil gun (the projectile is "pulled along" by the air-core coils).

So - wind your own coils - I would get some heavy gauge wire (so you can dump a lot of current through it), and wind some coils of about a hundred or so turns (maybe "cable lace" the layers together) on a cardboard or wooden dowel close to the diameter of the steel ball.

Make one, and experiment with it using a fairly beefy power supply (something that can source a lot of amps - your current power supply may be sufficient; you'll have to measure your coil resistance and calculate the amperage drawn for the voltage its run at).
43  Using Arduino / Motors, Mechanics, and Power / Re: Hardware options for Stepper Motors on: July 27, 2014, 01:36:43 pm
What are the pros and cons of driving a bipolar stepper motor with a motor driver IC, like the TI DRV8824 (perhaps packaged on a carrier board like Pololu's, vs. using the Arduino Motor Shield based on the L298, or perhaps just an H-bridge as documented in the links in the documentation for the Stepper Library?

Likely that TI chip is more efficient than the L298 - so that would be one thing it would have going for it.

On the other hand - in theory using the L298 (or better, your own custom driver system using discrete components or some other mosfet-based h-bridge or half-bridge chip) - driving it directly with the Arduino would potentially allow you to experiment with your own software-based chopper driving system (via code and such - you would need to implement a current feedback monitoring system, too) - different stepper drive modes, etc. Again, in theory, all of this could be done going that route.

If I used a 8824 or similar driver chip, would I be able to use the the Stepper library, or the AccelStepper library?

Unlikely - as you have noted:

It looks like these libraries are designed to handle controlling the 2 stepper coils directly, while the 8824 would do this itself, providing higher-level direction and step inputs.

Yes - the 8824 does everything for you. I bet if you looked, you could even find someone who has already created a library for the Arduino to make interfacing with the Pololu 8824 fairly easy - if not, such a library wouldn't be difficult to write (and would help others).

The thing you are likely missing about the L298 is that in the case of stepper motors, it wasn't meant to be used alone except in really low-cost applications (such as a DC h-bridge controller or for stepper motor uses where cost was a main factor) - there is a companion chip called the L297 which is meant to be interfaced to the L298, and it provides a lot of additional functionality to the L298 when used for stepper motor applications (take a look at the L297 datasheet, and reference the L298 datasheet side-by-side to see what I mean).

Even so - the pair of chips likely doesn't give everything that the 8824 does, it will have a larger layout on a PCB, and it won't be as efficient.

Then again, if you used that pair of chips, you still couldn't use the existing Arduino stepper libraries with it, because they weren't designed for that combination.
44  Using Arduino / Project Guidance / Re: Projector hardware? on: July 27, 2014, 01:24:44 pm
You could use an old-school galvanometer movement.

This could actually be more expensive and/or more difficult than anything else.

If you try to do anything like this without proper positional feedback (on professional galvos, this is usually done via capacitive or optical sensing) - you'll get a mess on the output.

More expensive if you decide to go with actual galvos - those aren't cheap (even used unless you get really lucky), and you need two of them; you also need proper driver boards (with feedback sensing), supplies, etc.

More difficult if you attempt to build your own galvos - which can be done (a few people have done so), but it requires a lot of time, effort, and money to build one, then duplicate it. Lots of fiddling with parts placement, etc (coils, magnets, positional sensing devices and more); then you still need to build custom drivers and feedback electronics to control the parts. Once you have something working, then you're back to tuning, etc. You'll be spending an equal - or likely longer - amount of time building the galvo system than you will on your primary project.

Again - open loop isn't the way to go here, but it can be done if you don't expect quality results (the output will look like a serial killer's scrawl at best). Basically, you want your positioning system to have low mass and high speed, with little "ringing" (settlement at stopping points). Feedback is used to achieve this in actual galvos; with homebrew open-loop "galvos" the problem is that the system usually has high-mass and no way to counteract this (because it is open loop).

One possibility (which will work ok - but still won't be ideal) would be to use bipolar stepper motors for the galvos (with a mirror mounted on the shaft); you energize one set of coils to "hold" the rotor, then you drive the other set of coils to work against the first set. The stepper will "vibrate" as you "position" (based on the voltage polarity, amount, etc). There's a bit on the internet on how to do this - again, it isn't the best method, but it works ok compared to other open-loop designs.
45  Using Arduino / Project Guidance / Re: What class do I use to make server. on: July 27, 2014, 01:10:00 pm
I assume you are referring to:

If you look at that - note the following:

Note the link for "Server" is referenced as the "ServerConstructor" - and reads:

"Server is the base class for all Ethernet server based calls. It is not called directly, but invoked whenever you use a function that relies on it."

Therefore - you NEVER call this; it is a constructor method - and is invoked automatically. Now note the following:

Which reads:

"Create a server that listens for incoming connections on the specified port."

As you can see - that is the method of the Server class you want to be calling.

In fact, the example code in that section appears to be everything you need to get started - essentially you would replace the "server.write()" portion in the if-then inside the loop() construct with your code to take the bytes written, and interpret them as you have already explained.
Pages: 1 2 [3] 4 5 ... 377