Line Tracking Photoswitch Info and Demo Video

Info gathered from other threads for one stop shopping.

Brown +
Blue -
White (sig) to digital side car
Black nothing

If the Sensor is Green: Sensor is powered but does not sense reflection. no output on blk or wht.

If sensor is Orange: ON sensor is recieving at least 2.5 times the signal strength needed to trigger an output and green will turn off. May have to adjust the sensitivity adjustment on top of the sensor to get an orange on if already mounted. Do this by placing over reflective surface and adjust until it comes on. Sensitivity is the screw on top. If orange is not on there will be no output on blk or wht.

If sensor is Yellow: the output has been energized meaning it sensed a reflective object. be careful most bright objects can be sensed regardless of color.

Typical sensor indication is the following
Green ON, Orange OFF, Yellow OFF over dull none reflective surface wht low and blk high
Green OFF, Orange ON and Yellow ON over bright reflective surface wht high and blk low

If you have a flashing LEDs, the sensor has gone in to short circuit protection mode becasue one of the outputs is shorted to ground or it is not wired up correctly. Make sure the black wire is not connected ianything. Make sure the white is connected to the signal pin on the digital side car pwm input and not the + or -. Best way to prevent the shorting out of the black wire is to clip the stripped wire and then wrap it with electrical tape. Inspect the sensor cable for any nicks. I will try and post a quick video by the end of today to show how it works and how to connect it.

Demo 1 01-22-2011
http://www.youtube.com/watch?v=t7pf-yWae0k

Demo 2 01-22-2011
http://www.youtube.com/watch?v=algLRT4Tawc

Hope this helps…

Photoswitch connection.jpg


Photoswitch connection.jpg

Hey do you have or know where I can get a working Java code for the Photoswitches? I have 3 of them connected to the DIO. I dont mind switching my hardware configuration to be compatible with yours if it is not already.
Narcisse- 1340

I’m sorry Belly, but I don’t. If I come across something I’ll keep you in mind.

My programming team is also having trouble finding example code. If you find anything could you let us know two?

Did you look at the LineTracker Sample Project in netbeans?

We have ours tracking the line as well with 2 or 3 sensors:

http://www.youtube.com/watch?feature=player_profilepage&v=PBG5g8geATw (3 sensors)

http://www.youtube.com/watch?v=06FPQb3XmFw&feature=player_profilepage (2 sensors)

Ethan

we can’t get code working in labview ? does any one have custome code rather than … default which is too hard to understand … we are rookie

I would start out by making a handwritten flow chart saying what you want it to do when each sensor is triggered. For example, when the left sensor is triggered, make it go right, and when the right sensor is triggered, go left. When neither are triggered, go straight.

Just use nested case statements and use the DIO ins to be the input for the case statements

Ethan

Thanks for replying, should i control motor inside the nested loop or change the value for x or y inside the loop ? which will be sufficient enough and how do i know tht i have reached the “Y” part, i just started the programming … ?

thanks for your help, will lwt you know if i have any problems … thanks

I put the set output inside the loop because its less cluttered, but you could just put the value inside, that would work just as well.

You know it gets in there when the desired thing happens when you try it with the robot.

i will follow your advise

tht’s wht i did now …

http://blackscots2076.ca/error2.JPG

any suggestion and yea how do i make robot turn slowly !!!

thanks again

I seriously hope you’re trying to be funny, becuase you have to put set motor output in there…

don’t use the arcade drive module use the set motor output module

and to make it turn slowly, just use (to go right for example) right motor output at .1 and left motor output at .2 with them both going forward

Ethan

http://blackscots2076.ca/error3.JPG

Does this look proper ?

or beacuse of having arcade drive module, the value from (set motor output) would not matter, right ?

should i keep it like this ?

if tht’s not the case then should i create new drive system (tank…) just for the autonomous and then switch it back to arcade ? OMG !!!

thanks man ! you have been greatly helpful

Ive never used the tank or arcade module so I wouldn’t know :stuck_out_tongue:

Should I assume you got it?

If so, congrats, and you’re very welcome, feel free to message me or email me whenever you need help

Ethan

I do have one problem with your code however. You need to open everything up in your begin.vi or you are going to run into a lot of problems. Also make sure you close everything in your final.vi

Ethan

Just a couple additional notes, since I’m an electrical engineering student and happened to be wiring the sensor up today.

  • The sensor acts like a switch that closes when it sees a white object. It’s using transistors inside rather than a mechanical switch, but as far as the wiring is concerned it acts just like a limit switch (except that it needs +12V power). Like a limit switch, it has a “normally open” and “normally closed” output; one output will be high when it sees a light object, the other will be high when it sees a dark object. Look at the sensor datasheet for all the gory details.
  • The digital sidecar has built-in pullup resistors, which means that unless you connect the GPIO pin to ground, it will have a value of 5V. This means you don’t need any additional circuitry to hook up the photoswitches. See the Digital Sidecar datasheet for more information.
  • The attached schematic tries to show the whole picture. Note that you could just as easily connect the black wire to the GPIO pin, it’s just a matter of whether you get a “1” for dark or a “1” for light. (My apologies if I mixed up LO and DO on the schematic. Let me know and I’ll fix it.)
  • The part number is 42EF-D1MNAK-A(2). The 2 isn’t given, but it’s apparently part of the number based on Rockwell’s part selection tool. If you haven’t found it already, a CAD model (STEP) is available on Rockwell’s site.

To those wondering how you program these things: it’s a switch - a digital input - a 1 or a 0. Once you calibrate it, it will have one value when it’s over the carpet and the other value when it’s over the tape. All you have to do is read the sensor value to determine if you’re on the tape or not.
If you have questions about how to follow a line, look at this white paper from NI, or ask an FLL student.





We have hooked the photoswitch up to the power distribution board and to the signal pin on the DSC, but we only recieve “true” when we use the DigitalInput get() method, no matter what surface the photoswitch is directed at. Any help would be greatly appreciated.

I found that initializing Victors (doesn’t matter if they are really there or not) solved my problem. The DB37 cable apparently needs to send more power and this is only possible by creating more “sensors” in the DSC
But before you do that, do your lights change color? Green when it sees nothing and orange and yellow when it does?

Ack! You need to make sure that you are properly supplying battery power to the Digital Sidecar’s small white Wago power connector. The power should come from a 20 Amp circuit on the Power Distribution board.

What did you use to connect the white sensor wire to connect the photoswitch to the I/O on the digital sidecar? :confused:
Sorry for posting such a basic question on a month old thread, but any help would be greatly appreciated. :o