Hello all, we are in need of some assistance. We have acquired a Balluff Photoelectric Sensor and are seeking some programming help.
We’ve never worked with sensors such as these, so we are unsure of where to start.
Any help is greatly appreciated.
Could you link the model number / data sheet?
Also, what language are you using?
The sensor is the Balluff BOS012P photoelectric sensor a link to the data sheet provided by Balluff is:
http://publications.balluff.com/mongodb_pdb/public_pdb_material.php?id=227057&revision=0.14&pg=PG150059&pf=PF152943&con=en&ws=approval
We use java to program our robot. We have looked for any sort of libraries and we have not yet found any. We are a young team and any assistance is greatly appreciated.
Really a two part question.
First part is programing. The sensor is digital input as for as programing is concerned. The input reads true (1) when not connecting to anything and false (0) when connected to 0 Volt (ground). The best way to test your program is to hook up a mechanical switch from 0V to the DI pin.
Second part is wiring the switch. The switch is actually a 24V product that will work down to 10 volts. Rather or not it will pull the output down close enough to 0 to switch the Rio logic is an open question. Hence the mechanical test recommended in part 1 to test your logic. Anyway the switch is wired as follows:
Pin 1: Wire to 12 volts A VRM (voltage regulation module) is best so the switch does not brown out.
Pin 2 or 4: Only one is used. Goes to the DI pin. 2 is NO. 4 is normally closed.
pin 3: Wire to 0 Volts. The VRM 0 V is common to the Rio and battery 0 V so it really doesn’t matter which 0 V you connect this to. I would connect it to the 0V on the Rio though.
Thanks for your reply. We figured out the wiring, we are only having trouble with the programming aspect of the sensor. We are not sure how to utilize the input, the sensor sends to the Robo-Rio.
Is there anything in the rules prohibiting use of a PCM to power components? Though we found another solution, we were considering the use of a PCM 24V output to power a sensor last year and I don’t remember us finding anything prohibitive in the rules. The PCM provides a max of 500 mA across all solenoid ports and this sensor has a max rated current of 100 mA, so power shouldn’t be a problem. Just something I wanted to point out because our robots seem to continuously have a shortage of 12V VRM ports.
The sensor boils down light information into a boolean. Presumably, some mechanism or object will come near the sensor and cause its output to change state.
In your code, you’ll set up a DigitalInput for the pin you connect it to, and read it every loop. You can know that when the read value changes between true and false, something has changed near the sensor - presumably you can use this info to infer a mechanism is in a position, or a gamepiece is inside the robot, or something like that.
I do not see anything in the rules prohibiting using a PCM output. The down side it is only enabled when the robot is enabled. On one level I would be worried about over-voltage protection on the Rio. In theory this would not be an issue with a NPN sensor since the output does not pull up.
Seeing that the OP is a Canuck, my first thought was English or French
The way the output is represented in the Balluf datasheet, the output is a pull-up only, not a totem pole type that pulls up and down. Thus, some sort of pull-down device needs to be added across the DI to 0V on the RoboRio, say a resistor. Otherwise, depending on the input characteristics of the DI, that input could just “float around” at indeterminate voltages when the sensor is not pulling it to the high level.
The spec sheet (see page 4) for the RoboRio shows that the DI’s have a range of 0V to 5.25V. It is best to stay within these limits to prevent damaging the RoboRio. This would require some sort of voltage limiting circuit or a voltage divider circuit.
If you are connecting Pin 1 to the VRM as Frank suggests, I would suggest connecting Pin 2 to a 10 kOhm, 1/4 Watt resistor. Connect the other end of the resistor to the DI on the RoboRio. Connect a zener diode across between the DI and 0V of the RoboRio with the cathode (banded) end connected to the DI. Alternatively, you can connect two 10 kOhm, 1/4 Watt resistors in series between Pin 2 and the DI and a third 10 kOhm, 1/4 Watt resistor across the DI and 0V of the RoboRio. In both these scenarios, the 10 kOhm across the DI to 0V provides the pull-down for the output of the sensor to work with.
Thank you Dan Waxman, mshafer1, gerthworm, FrankJ, and philso for your attention plus detailed replies. My students and I appreciate your time and insights. My students will try your suggestions in a few days when the Shop reopens.
Happy, safe new year to you, your families, and your students!
Apologies for not looking at the data sheet closer. The sensor is a PNP type. Which means as Philso stated, when actuated it pulls the load up to the positive voltage. It will not sink the load to 0. The Rio has an internal pull up resistor to pull the input high. Which means, as Philso suggests you have to add additional circuitry to to the input to pull it low when the sensor is not actuated. Otherwise It will not work. A better choice it to use an NPN sensor which is naturally sinking.
Thank you for all the replies. We managed to get the sensor working by using the pull down device. We are now trying to set up an analog inclination sensor from Balluff (BSI000U); here is the data sheet http://publications.balluff.com/mongodb_pdb/public_pdb_material.php?id=237777&revision=0.11&pg=PG179594&pf=PF179638&con=de&ws=approval
We are have difficulties programming the sensor. We are using a voltage divider to lower the voltage to 0-5V range using resistors. Any help would be greatly appreciated.