Pizero Explorer phat

Hello. I don’t exactly understand what the pins ( analog 1-4,inputs 1-4,5V,GND,OUTPUT ) do. I don’t want to short-circuit the board. The motors pins i get what they do.

I would like someone to explain the following use-cases:

  1. If i want to connect an analog IR sensor which pins should it be connected to .
  2. Can I run 2 motors , and 2 or if possible 4 analog sensors on the main ( microusb from rpi zero ) power or do i have to connect power to explorer phat ? And will it also power my wireless adapter ?
  3. Can i have a power source for the boards and an additional power supply for the motors and/or sensors? If yes how would i connect it ?

It would be really helpful if someone could explain the pins with an example.
here is a picture which could be used a support for explaining

    • If you want to connect an analog sensor, use the analog pins. They’re hooked up to an analog to digital converter, which turns an analog sensor output into something the pi can read more easily.
  1. The motor drivers can supply 200mA of current. Different motors draw different currents, so as long as your two motors are below that each the phat will drive them just fine.

As for overall power, you just need to have enough power for everything. A 2A power supply should be more than sufficient for the zero, a couple of motors and a wifi adapter.

  1. AFAIK, the pHat doesn’t support external power sources for the motors. I reckon you could use some output pins and a transistor though: https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistors should work (though you’ll need to modify the code for a pi and phat). The other option is to use a dedicated motor driver, such as this one which can do a whopping 1.2A: https://shop.pimoroni.com/products/sparkfun-motor-driver-dual-tb6612fng-1a

Hope that helps

1 Like

Thank you archieroques ! I understand 2 and 3 but I still don’t understand 1. My analog sensor has 4 pins ( en , out, vcc , gnd) From what I understand in your post the out pin from the sensor should connect to an analog pin on the phat . But how do i connect the other 3 pins ( en, vcc , gnd ) .

Also do you know what input ( 1-4 ) , output ( 1-4 ) do ?

You should check your sensor datasheet to make sure your sensor is 5v tolerant, if so, the vcc pin should go to the 5V terminal. If not then it’s possible to source 3.3V direct from the Pi header, see here.

The EN pin is likely just a way to deactivate the sensor (EN typically stands for ENable), and would be optional i.e no need to connect except if your use case requires it… but without knowing the exact sensor no one can really advise you whether it may serve an unusual purpose and should be connected (however unlikely).

Inputs 1, 2, 3 and 4 are just regular input pins, with the added benefit that they’re protected by a buffer to help prevent any accidental damage to your Pi.

If you wish to read a digital signal- such as pressing a push button- then you would use an input pin.

Outputs 1, 2, 3 and 4 are a little more complicated. They’re protected output pins, designed to let the Pi control an external digital device such as an LED or even a motor. However they don’t supply current, but rather optionally connect the Ground end of a circuit to ground.

Both the inputs and outputs are “5V tolerant”, this means you can put up to 5V into them without causing them, or your Pi, any harm. The Pi’s own pins only tolerate up to 3.3V, which isn’t so useful if you’re trying to drive motors or steppers.

As @RogueM says you should read the instructions for the analog sensor. Generally “VCC” connects to +5V or +3.3V, “GND” to Ground and the “Out” to an Analog input pin. But you need to know what voltage “VCC” should be, as putting 5V into a 3.3V device could damage it.

Thank you ! the analog sensor is 5v . Great forum , i didn’t expect to get an answer so soon . Have a great day !

2 Likes

Thank you!

We’re not always so quick off the draw, but always glad to help!

Happy hacking.