[SOLVED] How NOT to do a Science Project

hi everyone.

I have a infrared photo transistor right now and I'm stuck on trying to make it do various things. I wanted to use it so it can detect objects, it can be used for communication for my robots, specifically making them avoid each other, but when they find something interesting, that robot that finds the thing will stop and signal the other robots to come to that robot. I'm having a hard time trying to think of a program for that kind of application, and I'm highly doubting that a photo transistor can do these things, and I'm thinking of changing receivers. Is this plausible?

Please post the part number and a link to the datasheet .

The answer to your question depends on your experience with electronics. Obviously it would be pointless to recommend circuits that are beyond your level. What level is that ? In order for us to help , we need to know exactly what we are dealing with. Your post doesn't mention any specifics , let alone whether or not you already have a robot. Please post a SITREP (SITUATION REPORT)

SITREP:

For the Infrared emitters and receivers i have right now, they are Sparkfun's infrared emitter and detector pair: Infrared Emitters and Detectors - SEN-00241 - SparkFun Electronics The data sheet for the emitter is: https://www.sparkfun.com/datasheets/Components/LTE-302.pdf
The data sheet for the detector is: https://www.sparkfun.com/datasheets/Components/LTR-301.pdf

I'm not a pro at electronics, but I am a novice. By being a novice, I mean I have knowledge of many electronic parts: resistor, transistor, led, etc. Yet i lack the knowledge in circuits and shift registers, lcds, timers, and I still need to work a little on programming the arduino. Although I have little knowledge of circuits, I still can construct and use them if I know what they are used for, however I rather not use them... Currently, I have made one robot out of four robots, and I'm using them to create a swarm and make them work together. By working together, I want them to basically spread out and effectively traverse on a 4 x 2 foot table to find a piece of colored tape. Infrared communication comes in when the robots have to separate each other using the sensors, avoid obstacles, and in the end, when one robot finds the tape, it has to signal the whole swarm to it's current position. Now my question is whether or not a photo transistor is appropriate for this application...

IR transistor is good for a lot of things and some are easy to get working and some are not. Edge detection is maybe there best uses.

The ping HC - SR04 Ultrasonic Distance Measuring Sensor Module for Arduino / NewPing Library
ping
Is a lot more handy at not running into something.

be80be:
The ping HC - SR04 Ultrasonic Distance Measuring Sensor Module for Arduino...
...Is a lot more handy at not running into something.

Yeah, I looked into the ultrasonic sensor, but I found that I don't want to complicate my robot even more with an ultrasonic sensor and I just want to keep it limited to the ir sensors. To make the sensor sense in multiple directions, I have to add a servo or two ultrasonic sensors, and I don't want to complicate things further, and I just want to use the ir sensors to communicate and also detect obstacles.

4' x 2' is a very small arena. Practically any IR emitters & detectors can operate at this range, given that you understand how they work and the geometry. The thing that most newbie robot builders don't understand is that the key to using IR emitters and detectors is combining them with servos and doing triangulation. Pythagorean_theorem
If you can program an arduino to control two servos and store their postitions in variables, and you can understand geometry, then it pretty much comes down to whether you can figure out how to mount the components on the servos so that they intersect at the target. If you really want to maximize the concept you mount the two servos on a platform that is mounted on a third servo that rotates. You map the rotation positions to be +/- 90 degrees from dead forward of the robot and then you rotate the two servos (one holding the emitter and the other the detector) until you get detection from the target. the imaginary lines drawn in front of the two servos form the base and hypotenuse of a right triangle and the distance from servo A to servo B is the height of the right triangle. I'm a little rusty on geometry but
I believe:

Sin(theta) = b/c
amd
Cos(theta) = a/c

Where | a = base (known value : distance from servo A to servo B)

You can't use an equilateral triangle because the distance from servo A to servo B is small with respect to the distance to the target but you can use a right triangle, in which case the height "a"
is known, the right angle is known (90 degrees) but the distance dead ahead to the target and the distance of the hypotenuse is unknown. You can't solve with two unknowns so you have to find a way to solve one of those two. An ultrasonic sensor would work if you were looking for an object but you are looking for colored tape (on the floor ?) so maybe none of this is of any use.

To make the sensor sense in multiple directions, I have to add a servo or two ultrasonic sensors, and I don't want to complicate things further, and I just want to use the ir sensors to communicate and also detect obstacles.

You can use the servo to find the hypotenuse angle (from the servo position by storing the position in a variable every time you change the position). The right angle is known (90 degrees) and the height (distance from emitter to servo ) is known. Do the math. Maybe I am wrong about this but I think that's all you need to triangulate with IR sensors.

raschemmel:
You map the rotation positions to be +/- 90 degrees from dead forward of the robot and then you rotate the two servos (one holding the emitter and the other the detector) until you get detection from the target. the imaginary lines drawn in front of the two servos form the base and hypotenuse of a right triangle and the distance from servo A to servo B is the height of the right triangle. I'm a little rusty on geometry but

So the servos used for movement are used for your method, right? Well I actually had a different idea, that I would use the ir sensors for flocking, part of Particle Swarm Optimization. these robots will keep a distance from each other, increasing their efficiency for finding their main objective, but using ir can also be useful for detecting objects, so I wanted to do that. But how do you integrate both communication and object avoidance into an infrared sensor?

Now where have I seen this subject before?
Perhaps you should have continued your original thread on the subject?

And you'll have all sorts of trouble trying to also use your obstacle detection IR sensors for communications.
Ideally, you should maybe consider short-range RF comms between the robots.

OldSteve:
Now where have I seen this subject before?
Perhaps you should have continued your original thread on the subject?

yes I should have, I'm pretty confused on double posting and posting on the same subject, etc.

OldSteve:
Ideally, you should maybe consider short-range RF comms between the robots.

Well, i thought that infrared communication would be easier, and I have looked into Radio Frequencies, however, I haven't looked up how to use them for robots. I see that they are more expensive than Infrared technology, and I'm guessing that programming will be slightly more complicated... I'm really trying to make it simple, since I don't have that much time left.

brokenAvocado:
yes I should have, I'm pretty confused on double posting and posting on the same subject, etc.

Well, i thought that infrared communication would be easier, and I have looked into Radio Frequencies, however, I haven't looked up how to use them for robots. I see that they are more expensive than Infrared technology, and I'm guessing that programming will be slightly more complicated... I'm really trying to make it simple, since I don't have that much time left.

You might actually find RF communication easier than using IR LEDs and phototransistors, or at least very similar.
There are plenty of examples of using those cheap Chinese 433MHz RF TX and RX modules for communications. (I usually use more expensive serial RF modules, or encoding and decoding chips with the cheap modules, so can't help a lot with that aspect.)

For reliable IR communications, you really need to use an IR LED modulated at 38kHz or 40kHz, with a matching 'demodulating' receiver, like those used for infra-red remote controls.

Either way, I know you're up against it in terms of time. (Less than 4 weeks left to complete your whole project, if I remember correctly.)

A few posts back I suggested using the 433 Mhz for the inter-robot comm and the IR for range sensing.

Look at it from a different perspective. If you were camping in a forest and all your fellow campers/hikers got separated and then the sun went down, how would you all communicate if you all had flashlights in your backpack. If you had a pre-arranged code assigned to each of you and instructions to transmit you FOF (Friend or Foe) ID code repeatedly until you got a response, if your code is 2 blinks and keep repeating that and eventually you see a flashlight returning 5 blinks would you have any doubt who was returning the signal or where they were ? What if you had other code protocols like :
"go N, XXX yards , STOP, RETRANSMIT , WAIT, etc..." Is there any reason this scheme wouldn't work with robots transmitting IR ? If your sensor was mounted on a rotating servo and you knew the servo position when you received a reply would you not know who was at the other end and where they were ?
You might not know their distance but you might be able to triangulate.

raschemmel:
A few posts back I suggested using the 433 Mhz for the inter-robot comm and the IR for range sensing.

Look at it from a different perspective. If you were camping in a forest and all your fellow campers/hikers got separated and then the sun went down, how would you all communicate if you all had flashlights in your backpack. If you had a pre-arranged code assigned to each of you and instructions to transmit you FOF (Friend or Foe) ID code repeatedly until you got a response, if your code is 2 blinks and keep repeating that and eventually you see a flashlight returning 5 blinks would you have any doubt who was returning the signal or where they were ? What if you had other code protocols like :
"go N, XXX yards , STOP, RETRANSMIT , WAIT, etc..." Is there any reason this scheme wouldn't work with robots transmitting IR ? If your sensor was mounted on a rotating servo and you knew the servo position when you received a reply would you not know who was at the other end and where they were ?
You might not know their distance but you might be able to triangulate.

IR comms would seriously interfere with the IR obstacle detection and vice versa, too.
I ran into trouble with my robot for a similar reason. I use 40kHz US ranging, but also wanted an ultrasonic homing system. I finally decided to buy some 25kHz US transducers to get around that. I haven't ordered them yet though, so am using IR homing for the moment. (No IR obstacle detection yet, so I can get away with it for now.)

In brokenAvocado's project, there are already going to be heaps of problems to overcome in getting the robots to 'swarm' and move synchronously together. It's a pretty interesting little project. Not so little, actually, when combined with the planned colour-sensing and finding a specific-coloured strip of tape.

I was actually thinking that it would be either/or . Ranging or Comms alternating but never both.
They could still interfere. The project goal is problematic.

raschemmel:
I was actually thinking that it would be either/or . Ranging or Comms alternating but never both.
They could still interfere. The project goal is problematic.

Yep. If four robots are using either IR obstacle detection or IR comms, there needs to be some way of synchronising them to switch from one to the other at the same time.
RF is a much simpler option, since it can happen at the same time as the IR obstacle detection.

Overall, it's a most interesting project, and one I'd be tempted to have a go at myself. I doubt that I could build the robots AND get it all figured out and working flawlessly in under 4 weeks though.
brokenAvocado really does have his work cut out for him.

OldSteve:
Yep. If four robots are using either IR obstacle detection or IR comms, there needs to be some way of synchronising them to switch from one to the other at the same time.
RF is a much simpler option, since it can happen at the same time as the IR obstacle detection.

How difficult is it to synchronize both the infrared aspects? But if that's too difficult, how could you implement RF into a swarm like this? I want to know how RF can transfer data, and if the signals for RF can be limited to a few robots, and can be amplified to the whole swarm. I can see how this would work, but how would the robots differentiate which transmitter is theirs and which is not. Also, what transmitter and emitter for RF can be right for small robots like mine.

All of the robots can receive the same RF signal . You can syncronize them with RF but you have to figure out how they will know where the other robots are.

brokenAvocado:
How difficult is it to synchronize both the infrared aspects?

That was my point. Virtually impossible. Unless you used RF for communications to synchronise the switchovers, but then of course you wouldn't need the IR comms anyway.

But if that's too difficult, how could you implement RF into a swarm like this?

How did you plan to implement IR communications? Do it the same, but it will work better with RF.

I want to know how RF can transfer data, and if the signals for RF can be limited to a few robots, and can be amplified to the whole swarm.

You said in your other thread that you wanted 5 robots, if I remember correctly. So I don't get this "few robots" vs "whole swarm" thing. There are only a few robots anyway. I don't understand what you mean by "amplified to the whole swarm". RF transfers data in a similar way to a serial connection. You'll need to use different methods depending on the RF modules you use. Serial with some, Wire with others, SPI with others.

I can see how this would work, but how would the robots differentiate which transmitter is theirs and which is not.

See what I meant last week when I said you'd left things way too late. You said in your other thread that you'd spent the year learning how to use Arduino and "doing research", (and wasted the whole Summer break playing video games). In reality, you didn't do a whole lot of research at all.
In your RF comms, you'll need to devise a protocol that will cover the points that you raise. A good start would be to give each robot a qualifier - an address. There's a lot to be said for sitting down with pencil and paper, drawing up flow-charts and writing pseudo-code.

Also, what transmitter and emitter for RF can be right for small robots like mine.

Emitter? I guess you mean receiver. :slight_smile:
I think I suggested a search yesterday. You could use cheap Chinese TX / RX pairs, or nRF24L01 sets, or APC220 transceivers, or DRF7020D13 transceivers, or .........
Whatever you use, you'll have to decide fairly quickly, especially if you have to order them online.

Do some searching on the forums, read how others have done this sort of thing. At the moment you're completely in the dark, it seems, and time is running out.
Googling search terms like "Arduino RF Communication" and similar should produce plenty of results, too.

(and wasted the whole Summer break playing video games). In reality, you didn't do a whole lot of research at all.

DOH !

raschemmel:
DOH !

Yep. With such an interesting project, I would have been more interested in the project than video games.
I don't see much chance of finishing this is less than 4 weeks. Maybe 4 months.

Edit: It's still well worth completing, though, even if it can't be done in the allotted time, I reckon. I'm getting more and more interested in trying a similar thing myself.

I had this idea, that ir object detection would just work with the led at high and the detectors detecting the light. This could also work for the communications, and at the end, when one robot finds the objective, it would send a certain frequency or pattern of ir light that the robots would detect and come to that source. However, I was interested in the pulseIn() command and the delayMicroseconds() commands to work together, and thought it could work. I didn't want the radio frequencies so I want to do something other than RF. RF is my last resort.