Connecting distance sensor to mini maestro and power supply?


I have a question for an understanding and patient pololu engineer,
I am really out of my comfort zone (biology major) with these products so pardon the ignorance but I am looking into setting up a 4-30cm analog distance sensor to a mini maestro servo controller 12 channel fully assembled USB and attempt to recreate the graph that was inidicated on the website for some eventual plant research (trying to go it alone a bit and hopefully learn something new in the process). I have these parts and the 3-pin female JST cable with male pins (but also have F-F jumper wires in hand if needed) and need help on how and where to put the output wire (white), ground (black) and the power (red) onto the maestro. I then assume I’ll need to connect with a usb cable (which I also have) to the computer and download software that will help show me the output when something is near? For this sensor I don’t plan to connect to robots i just want to simply detect distance to an object within the sensors range. Finally as I am completely new to this and have little to no understanding of all things electrical, can a pololu engineer help me to power this unit in a safe manner? What battery pack should I order for this set up? Where on th mini maestro would I want to hook it up?
(The more detailed description as to how to hook these up, i.e. what pin should I have and what should the connector be? F? M? or bare wire? what jumper cables can get me to the correct wire hook up,where on the board this hook up is located, will be very helpful. Thanks!


That sounds like a cool project! So you have the following:

Yes, you will need to download software from our website in order for your PC to communicate with the Maestro over USB. I recommend that you do this first, before making any electrical connections to the Maestro. It should only take a few minutes. Assuming you have Windows, you can get the software from the “Installing Windows Drivers and Software” section of the Maestro Servo Controller User’s Guide. Please follow those instructions. Then please run the Maestro Control Center and make sure that you can successfully connect to your Maestro over USB. If you were able to successfully connect to the Maestro, you should see a serial number in the dropdown box at the top left and most of the controls should be enabled. You will, of course, need to connect the Maestro to your computer via a USB A-to-Mini B cable.

Let me know when you have succeeded at that and then I can help answer the rest of your questions. I’d like to help you with one question or issue at a time because I think it will be easier for us.


Thank you for your quick response and it looks like the serial number is showing up. I don’t have any of the batteries (if needed) on hand, and would have to order it if that is what I need just to be a little more clear. So Looking good so far with a green LED flashing and a yellow one blinking.

Ok, now that you’ve established a USB connection to the Maestro we should figure out how to power the sensor.

The power requirements of the sensor are listed on the product page:
operating voltage: 4.5 V to 5.5 V
average current consumption: 33 mA (typical)

This means you need to find a power supply or battery whose voltage is within 4.5-5.5 V and can supply 33 mA of current or more. You already have such a power supply: it’s your computer’s USB port. The USB voltage can be accessed from the Maestros GND and +5 V (out) pins.

Is there a particular reason you wanted to use a battery? Are you equipped to solder some pins into the Maestro?


Wow, thats great, how then do I use those pins with my computer? I dont want a battery for any specific reason, just thought it was how you get power. Thanks!

There is a ~5 V difference between the Maestro’s +5 V (out) pins and the GND pins, which comes from USB. You can use this to power the sensor. Please note, of course, that this will not work when the Maestro is disconnected from USB because the Maestro has no batteries built into it. What you want to do is connect one of the Maestro’s GND pins to the black wire of the JST cable and one of the “+5 V (out)” pins to the red wire.

Given that you have a JST distance sensor cable with male pins, the best way to make those two connections would be to solder a 1x2 female header onto the pair of pins labeled “+5 V (out)” and “GND” that are in the middle of the Maestro. Do you happen to have a 1x2 female header?

If not, male header pins would work fine. The male header pins can be broken apart, so as long you have two or more of them you can make this work. Here are the male header pins:


Ok, so does it matter that at the locations where it says +5V(out) written on the back of the board is just a little hole? No pin is there? And I should mention that I don’t have soldering capabilities. Plus there appear to be more than one +5V(out) holes on the board. Does it matter which one? Thanks again for working with me on this.

Those holes have the right size and spacing (0.1") so that one can solder either female or male header pins. That is what they were designed for. Those holes are actually the same shape as the other holes on the board (e.g. RX and TX) but they look very different because the RX and TX holes have header pins soldered in and the holes have been filled with solder.

It doesn’t matter which +5V(out) line on the board you choose, but you need to connect one of them to red wire from the sensor. Unfortunately, the best thing I can think of for you is to just stick the male end of the red wire into one of the +5V(out) hole and hope that it maintains electrical contact. You might stick it in at an angle and do something clever with a small rubber band to provide some force to hold it in. If it loses contact, the sensor would become unpowered. That could mess up your data but otherwise I don’t think it will do any permanent damage.

Let me know when you have done that and we can move on; the GND and signal connections will be easier because there are male header pins soldered in to the Maestro for those.


Another option that doesn’t involve soldering would be to use a battery pack, but of course there is the hassle of remembering to charge the battery. Do you mind if I openly discuss some of the relevant parts you have ordered from us that I see in your order history?


Ok, please feel free to bring up some of the items I have ordered. It should include some battery packs, jumper wires, tools, and some items for the next piece of equipment I’ll be posting questions for regarding power to the linear actuator ( but this is for another post and hoping I can learn a few more basics from this project and apply these learnings to the linear actuator project.) I certainly don’t mind holding the 5+V red power line in place to at least get to a point where I can see “signs of life” form the signal wire. By the way, where would the signal wire be connected? You said there is a pin for this? (by the way this is really fun, sorry it must feel like holding hands a bit).

Thanks again for the support!

I see you ordered a battery charger from us and some batteries, but unfortunately those batteries are the wrong voltage to power this distance sensor.

It sounds like we should just forget about the batteries for now.

You should decide what channel to connect your sensor to. It doesn’t matter much, so you can just pick Channel 0. Then in the Maestro Control Center, please go to the Channel Settings tab and configure that channel to be an Input by selecting “Input” in the corresponding dropdown box. Be sure to click “Apply Settings to Device”.

Now you should disconnect your Maestro from USB and wire up the sensor!

After connecting the sensor to the JST cable, there are three more connections to make:

Ground: Connect the black wire to a F-F jumper wire. Then connect the other end of the jumper wire to any of the GND pins on the Maestro.
Signal: Connect the white wire to a F-F jumper wire. Then connect the other end to the signal pin on the channel you selected. Each Maestro channel has three pins. The signal pin is the one that is furthest from the edge of the board, right next to the channel number.
Power: “Connect” the red wire to one of the +5V (out) pins of the Maestro and hold it in place with a finger or a rubber band.

Now that you’ve wired everything, you can plug the Maestro back into USB. Go to the Status tab and see if the value displayed for your input channel corresponds to a distance measurement! If you’ve wired and configured everything correctly, the value of that channel should increase and decrease as you move objects towards and away from your distance sensor.


YES!!! Successs!!! This is so great :slight_smile: thank you so much for the support. So I see that the batteries ordered may be incorrect for this device but I actually also ordered these to help power the jrk controller and linear actuator (4" 5:1 w/feedback) (but perhaps they are wrong for that as well). Would you recommend the battery product that will work for these two different devices? Thanks again!

Great! I’m glad it worked.

It sounds like you want to control a LACT4P-12V-5 with a jrk motor controller and power the system using one of the battery packs you purchased. The best battery pack you have would be the Rechargeable NiMH Battery Pack: 7.2 V, 2200 mAh, 3x2 AA Cells, JR Connector and it would probably work, but you should be aware of two caveats:

  1. This battery pack is not the ideal power source for the linear actuator. It only provides 7.2 V but the actuator was designed to run at 12 V. That’s OK, but you won’t get as much speed as you could have gotten with a 12 V supply.

  2. The battery pack should NOT be connected to the GND and VIN pins that are next to the ERR pin. The traces to these pins are not designed to handle the large currents required for driving motors. The proper pins for connecting the battery pack are located near the motor outputs.

You could power the jrk and the Maestro from the battery, and power the distance sensor from the Maestro’s +5 V (out) line as you are already doing. Alternatively, if the Maestro is going to be connected to USB then you don’t need to power it from the battery.


Ok, do you have suggestions on how to power the actuator aside from the inferior batteries that I have? I don’t mind getting additional items if necessary. I will be keeping the actuator and the distance sensor as separate projects (not to be in the same location), so even if I need separate items for each that will be fine. As for the actuator, I tried to connect the AA 7.2 2200mAh battery back to the +5V(out) and ground pins near the FB and Aux pins and then attached this by USB to my computer. Turned on the software and was getting an error stating no power. On the board there was a continuous red light. So is this occurring because the commands for the actuator are at maximum speed (thus power draw) and leading to no activity. What would you recommend to reduce the settings to in order to get any movement at all? On the input tab it was set at aboslute max of 4095, under motor max duty cycle was 600. Any changes to PID? Or will I have to play around with it to find how slow I’ll have to go to get it to work for now? Does pololu sell the appropriate power configuration to get the 12V power this item needs? Can you recommend parts?

Thanks again!

Unfortunately, our 12VDC wall power adapters are out of stock and it will probably take a while to get them back. To find a power supply for your actuator I would search Google for “12 V power supply” and see what comes up. Here are some power supplies I found by doing that search; I haven’t used them but maybe one of them would work for you:
The “12V 5.0A Switching power supply” would probably work, but the actuator’s stall current is greater than 5.0 A so you would want to use the jrk’s acceleration limit feature to prevent it from abruptly starting up. There are more expensive adapters available that provide more current and would probably work better.

That’s the wrong place to attach power and making that connection could actually damage the jrk permanently. The power needs to be attached to the GND and VIN pins near the motor outputs. Note that you will need to charge the battery before using it for the first time. Let me know if you still have trouble after fixing that, and I recommend reading the jrk user’s guide or asking here when you are unsure about how to connect something.


Thanks and I will look on google for the 12v power supply. Good thing I didn’t charge the battery first, probably saved me from damaging the jrk! :cry: Will look at this part of the manual more closely.

Thanks again