Good day everybody,
My name is Peter, I am a hobby programmer and like to tinker with electronics. My current goal is to create a simple control system for a drone. As a basis I use a Raspberry PI with Python code. For most control parts I use Pololu boards. At the moment I have a cluster of the following sensors and other parts.
- Mini Maestro 24-Channel USB Servo Controller
- MinIMU-9 Gyro, Accelerometer, and Compass
- ACS709 Current Sensor Carrier -75 to +75A
- Pololu Step-Down Voltage Regulator D15V35F5S3
- Maxbotix LV-MaxSonar-EZ1 Sonar Range Finder MB1010
Everything is working, or seems to be working. I connected the ACS709 and LV-MaxSonar-EZ1 to the Mini Maestro. Now my problem starts here, I can read the input values on the Mini Maestro using the serial (via USB) commands. But both in Python and in the Maestro Control Center the values are higher then I would expect.
The forum already gave a few answers to the ‘leaking’ current, so I only connected the ACS709 and even tried the ground <-> input pin. But the measurements still give ± 144 in the MCC and 575 from the serial line. By my calculations that should be around 2,807 voltage and my multimeter says I only get 2.51 volts from the ACS709. The same ‘faulty’ readings are seen from the LV-MaxSonare-EZ1, also tested alone and of course together.
In Python I use the following code to read the voltage:
def get_port(self, port_number):
port_number = int(port_number) # set port_number to integer
while self.running_query: # check if there is not someone else running a query
time.sleep(0.0001) # wait for other query to end
self.running_query = 1 # make sure you are the only one quering
msg = chr(0x90) + chr(port_number) # create message
self.port.write(msg) # write message
time.sleep(0.001) # wait for result to be ready
response1 = self.port.read(1) # read one byte
response2 = self.port.read(1) # read second byte
hb = binascii.hexlify(response1) # transform byte to 2 digit hex representation
lb = binascii.hexlify(response2) # transform byte to 2 digit hex representation
position = int(lb + hb, 16) # 0A + 07 gives 0A07 int('0A07', 16) = 2567
self.running_query = 0 # end the running stage
def get_voltage(self, port_number):
port_number = int(port_number)
position = self.get_port(port_number) # get the position of portX
bitpervolt = 5.0 / 1024 # the 5 volts have 1024 steps (0 to 1023) so every point is 0,0048828125
voltage = position * bitpervolt
Does anybody have an explenation for the wrong readings?
It sounds like you are trying to make a whole chain of devices and interfaces work all at once. Let’s focus on one device and discard the Python for now. How about we focus on the ACS709? You are measuring 2.5V on the output of the current sensor. What value are you getting in the Maestro Control Center? Can you tell me exactly how you have everything connected and powered? A picture of your setup would be helpful.
Below we have a picture, hopefully it is clear enough. Else I will bring it back to the bare essentials.
The setup consists of the ACS907 connected to the power supply and the voltage regulator providing the 5 volt to all other components. At the moment I measure 5.01 volts from the regulator.
I measure 2.51 volts (most accurate reading uptill 20 volts on my multimeter) on the white/black wires of the ACS907. The Maestro Control Center gives between 144.75 and 145.25 at this moment.
Hope this is more usable for a sollution.
Thanks for the additional explanation and picture. I now have a much better idea of what is going on.
What points are you measuring across with your multimeter? Which channel # are you looking in the Maestro Control Center? A screenshot of the Maestro Control Center would be nice. One possibility for the discrepancy is you are looking at one of the floating lines, which are influenced by the ADC readings of the previous pins. Just to double check, you have configured the mode of channel 7 to be an input, correct?
I measure the voltage over VIOUT and GND on the ACS709. I toke the same measurements on the S and - pins of connection 7 on the mini maestro. As far as my multimeter goes it says the signal line on 7 is 2.51 volts.
In the screens below you can see the settings. For testing purpose I made sure only connector 7 is attached and working.
Can you measure the voltage on the pin labeled +5V (out)? I suspect it is going to be lower than 5V and that will account for the issue we are seeing.
You might also want to consider powering the Maestro’s VIN from the step-down regulator to burden Raspberry Pi less and possibly increase the reference voltage a bit.
Yes when I measure the voltage on the middle of the board I get 4.45.
I’'m a bit confused right now, in the manual it sais you have to connect VIN with VSRV to power both the processor and servo with the servo voltage. Do I now need to a a two wire connection to the top left connection as well?
Yep, 4.45V explains the discrepancy completely.
I recommend connecting VIN to VSRV using the included shorting block between the orange- and red-outlined pins that are right next to one another on the left middle of the board.
Then there is something wrong with my board. The shortening block is in place. You can actually see it in my photograph.
Can I provide power another way? Or test for a fault?
Sorry, I did not notice the shorting block was in place! I suspect VSRV is not being powered by the regulator. Can you measure VSRV? If it looks okay, can you try disconnecting USB and seeing if that does anything? What state are the LEDs in and what is the voltage on 5V (out) when you do?
VSRV is 5.01 volt, just as the servo input.
If I remove the USB cable the orange LED above the middle 5volt station blinks. Without the shorting block everything goes black.
The voltage on +5V is still 4.45.
The rest of the place I would expect 5 volts are OK. In the color picture of the voltages, everything but the yellow is as it should be.
From the upper VIN, next to the USB, there is a small diode or resistor SMD. After that everything is below 5 volts. I measure 4.7 volts just behind the first SMD and the upper right pin of the 5 legged SMD also is 4.7 volts.
I just tried applying 5V to VIN on a Maestro I have here, and I got similar voltage for +5V (out) (4.44V). It sounds like your Maestro is behaving normally. I think that the easiest thing to do is just live with the voltage you have and do your calculations based on that.
Thank you for all the support. I will try some other things, There might be a possibility to fabricate my own mini USB connector with the power coming from the regulator. Or I can put 14 volts on the servo input and power the ACS709 from the 5 volt of the regulator.
At least I know where to look.
If you have 14 V, you can connect it to VIN on the Maestro and leave VSRV at 5V, as long as you disconnect the VSRV=VIN shorting block. The Maestro’s VIN voltage can be 5 to 16V.
Good luck with your project. It sounds like you are using an interesting array of components and I would be interested to know how it turns out!