Wiring for motor with two pulse wires

Aittle help please, I have Just received details of the wiring for the motors for a new Rpi project which are as follows:

"Each motor contains a Hall effect sensor on the motor shaft. This provides 2 pulses per revolution of the motor (300 pulses per revolution of output shaft) and can be used by your software to determine the distance moved.
You must power the Hall effect sensors separately with 5V to the V and G inputs, the output is taken from the S1 and S2 signals

The wires from the motor are coloured as follows
Black - Motor Ground
Red - Motor Power (7 - 12V)
White - Sensor Power (5V)
Yellow - Sensor Ground
Orange - Sensor 1
Green - Sensor 2"

I have found the diagram showing how to wire for a motor with one sensor but not two. Can orange and green both be wired to the program header pin 4 for one motor and 5 for the other ?
The sensors need a 5v supply can I take this from the daisy chain block pin 2 ? and if so should I take ground to the program header or daisy chain block ? (power for the project will be from 9.6v battery packs supplying the Rpi via a battborg and separate direct connection for the motors)

I'm a novice at this and don't want to fry my Reverse!! guidance appreciated.

piborg's picture

No problem, I know the feedback support on this board can be a bit confusing :)

There are a couple of problems with your intended setup that will prevent this from working correctly.

Problem 1: 5V vs 3.3V

The PicoBorg Reverse will only accept 3.3V signals into the taco pins, it cannot handle 5V inputs.
This is also true of the GPIO on the Raspberry Pi itself.

Solution A: See if you can use 3.3V

It is a bit of a long shot, but you could try powering the sensors using the 3V3 pin instead.
This would solve the problem, but it is fairly likely that the sensors will not work and do need a 5V supply.

Solution B: Use a level shifter

The correct solution is to power the sensors from 5V and use a level shifter to convert the signals to 3.3V.
A board like this should do the trick: Adafruit 4 Channel I2C Bi-Directional Logic Level Converter.

You will need power from a 5V, 3V3, and GND pin to do the conversion.
You can use 5V from the daisy-chain connector.
Both the 3V3 and GND pins can come from either the programming header or the daisy-chain connector.

Problem 2: Two signal lines, one pin

Put simply the PicoBorg Reverse only supports a single signal from the motor, not a full pair.

Solution A: Use a single signal

There is no point in connecting both signal wires for a motor to the same pin.
In the best case it does not help, in the worst case it may damage the sensor!

You can still use the taco pins on the PicoBorg Reverse, just use the sensor 1 signal only on each motor.
I would recommend putting some electrical tape on the end of the sensor 2 wire to prevent it accidentally connecting to anything.

Solution B: Use the GPIO instead

What you could do is use the GPIO on the Raspberry Pi itself instead of the taco inputs on the PicoBorg Reverse.
Note this will still need the 5V / 3.3V problem above to be solved.

Advantages:

  • You can use both signals, this should be more accurate
  • It will be able to tell the difference between forward and reverse movement
  • As the data is available to the Raspberry Pi you can get a speed measurement as well

Disadvantages:

  • You will need some code to read the sensors in your script / program
  • The encoder / feedback based movement commands in the PicoBorgRev library will not work
  • You need to ensure the script / program sees each signal change, otherwise the readings will be wrong

Thanks for your helpful and clear reply.
I will give it a try using 3.3v and one sensor initially. I probably don't need the extra sophistication of the second sensor output. If it doesn't work the level shifter suggested looks like a good solution.

Subscribe to Comments for "Wiring for motor with two pulse wires"