We have our line trackers correctly calibrated, and the lights change. In our code, we print the value of the trackers to the driver station’s user message box. Every time it prints out three 1’s, even though the tracker lights are changing. We have all 3 trackers declared correctly, as well as their solenoid counterparts which need to be set to True at the beginning. Can someone provide us with code that will get the values from the trackers and print them to the user message area? Our trackers are called trackerL, trackerM, and trackerR. They are declared as Digital Inputs, and we use pointers to declare them. Thanks!
This means that your wiring is wrong. Make sure that the PWMs are created correctly and plugged into the Digital I/O ports on the Sidecar.
This is where I’d typically use the lamp post technique.
You grab someone on the team and explain why the system should work. If they are knowledgable of electrical and programming, this is a true review of your system. But often, as you are explaining how it works, you will find your own mistake. So, in reality, if an expert isn’t around, many times a less experienced member will work, perhaps even an inanimate object such as a lamp post.
In this case, follow the wires from the left sensor back to the breakout. Make sure the breakout has power LEDs on too. Check the channel and area on the breakout make sense. Then follow the cable from the breakout to the cRIO module in slot four.
It may also be useful to remove the sensor and print the digital input signal when it is connected to the ground and to the 5V pin. This will help cut the problem in half – Is it on this side or that side of this connection?
Greg McKaskle
Thanks for the replies, we think we found the problem. We got voltage readings from the trackers and the results were surprising. I’m not 100% sure about the precise voltages, but I think they were giving us something like 0.35 volts when they were on the line, and 0.75 volts when they were off the line. The electrical lead tried to explain why this might be the problem, but it went right over my head. He hooked up a resistor to the simple circuit he had and the voltages then changed to 0.35 when they were on and 18 when they were off. We’re hoping that the reason it wasn’t working was because there was such a minor difference in voltage between the 2 states.
The one thing that really bugs me (as well as our electrical subteam) is that there wasn’t a single bit of documentation stating that we might need a resistor to get the trackers to work. I looked through the programming forum, and from what it looks like we were the only team experiencing this problem. Are any of you guys using a resistor with your trackers? If so, how did you realize that you needed to?
I’ll get back to you guys tonight after we see if this fixed it.
You shouldn’t need a resistor unless you wired it incorrectly. The light sensor output is an open-collector. So if you connect it to a digital input channel which is internally pulled-up (i.e. it has a built-in resistor), it should just work.
Yeah, no resistor is necessary.
You said you declared them as Digital Inputs. Did you then have them connected to Digital Inputs on the Digital Sidecar? Only the signal wire should be used; the power and ground come from a 20A circuit on the Power Distribution board.
If you didn’t connect them to the proper pins (e.g. miswiring them to the Digital Sidecar ground instead of signal), you wouldn’t have been able to read their state. A disconnected Digital Input always reads as true.
Don’t mean to thread steal, but I have an exact setup here. However, the line tracker flashes true and then stays false.
I have calibrated the sensors already.
Any suggestions?
Never heard of it as the lamp post technique, I always heard about this as the ‘Rubber Duck Debugging’ technique. So carry a rubber duck in your pocket.
P.S. In the future, source code of what you’re trying to do is welcomed.
Sounds like your wiring is off. I will try to explain in simple terms.
The signal output pin of the sensor is a transistor used as a switch which effectively connects the pin to ground. Under normal circumstances, it would require a “pullup” resistor to a positive voltage so that it can pull down to ground when it is activated. (Does that make sense? In Active state it pulls the signal to ground, in off state the resistor would pull the signal to positive.)
As I’ve learned from poking around this forum, the digital side car doesn’t need a pullup because it has this functionality built in. Just connect the signal directly to the signal input on the digital sidecar.
Now the fact that your reading 18V troubles me. I’m guessing you chose to use the 24V supply, and it sounds like your electrical lead chose to tie a pullup to the higher voltage. I’m not sure what the input signal limit is but a high voltage like that might cause damage. If you were going to use a pullup at all, it should be to the 5V, but it’s not neccessary.
I agree, the wiring could have been better documented, But here is what I’ve gathered on the sensor wiring:
The sensors can either be powered by 12 or 24V. If 24, you need to go through a solenoid breakout, supply it from the 24V ouput, and then supply the sensor power through a solenoid output. (requires programming to turn on the sensors) Or you can splice the power lines together and feed them through a 20 amp breaker, just make sure battery voltage doesn’t dip below 10.4V.
The signal outputs should each go to a Digital input on the sidecar, no pullup needed. Lastly, check the configuration of the digital inputs on the driver station. They can be configured to run pull-up, pull-down, or floating input. make sure the are set to pull-up.
I tested ours and the readings are .7V when it’s on the tape, and 4.0 V when it’s on the carpet.
Good Luck!