Battery upgrade, and proximity sensors

Well, this weekend we had the chance to test our new battery pack. Previously, we were using the standard Lego battery pack, which uses 6*AA batteries. As we were using rechargeable batteries, that meant a total of 6*1.2V = 7.2V. Then we have the voltage regulator, to ensure that the pi gets 5V max, and the batteries get what’s left over. As I understand it, the voltage regulator itself uses ~1.5V, so with 7.2V input, the motors aren’t getting much more than 5V themselves, even with full charge on the batteries. Anyway, our new custom-designed battery pack uses 3*3.7V LiPo batteries, so a total of 11.1V (the regulator should cope with up to 15V input). First problem we had was heat – the heat sink we had wasn’t up to the job, but the addition of a large slab of aluminium plate has helped. This provides a much higher input to the motors, and boy did we notice it:

Driver thought this was rather funny too:

Fortunately, being Lego-based, it was a quick job to reassemble (and while doing so, strengthen). Some hill-climbing was then tested, quite successfully:

I’m told that it managed to climb even steeper slopes than this, but I wasn’t there to see it (or capture it on video).

What was I doing? Thinking about the next challenges: straight line speed test and maze. For these, we need proximity sensing. Well, for our planned solution we do anyway. (Another approach would be to use the PiCam and image processing.) So I’ve been thinking about proximity sensors. I have a bunch of HC-SR04 sensors (the same ones as are in the CamJam EduKit Robotics kit), and they should do the job, but I wanted to explore some other options. One I considered was the VCNL4010 proximity/light sensor, partly because I was interested in learning about i2C. I’ve had a couple of them in my components box for a while, but this weekend was the first chance I’d had to try one out. I had a look around the web, but few people seem to have used these with raspberry pis. One nice tutorial was found here though. (It uses VCNL4000 sensors, but they’re effectively the same thing minus the light sensor… which I don’t need anyway!)

First frustration was to discover that Peter had unhelpfully soldered the headers on to one on the wrong side! 😠 I put the other one together the right way round, wired it up, and downloaded the sample code from AdaFruit. Sadly, while the light readings seemed to be sensible, I couldn’t make sense of the distance readings. I know that they’re meant to be logarithmic, but even so… So maybe I did a bad job of soldering the headers on… I couldn’t see a problem, but just in case, I desoldered the back-to-front one and resoldered it the right way round. Sadly it then gave exactly the same readings as the first one. So unless I’ve managed to do a bad soldering job twice in a row (and I’m not a novice at soldering) that I can’t see (admittedly, my eyesight isn’t great!), the problem must be elsewhere… I’m just not sure where! A bit of reading about reveals that you can change the IR LED current on the sensor to adjust the sensitivity, but I’m not sure that this will fix the issue. There are also a number of other problems:

  1. Although this is an i2C sensor, it has a fixed i2C address. This means that if I want more than one (which I do, as I need to sense distance all around), I’ll also need an i2C multiplexer. More messing about…
  2. The range for this sensor is only up to about 200mm (and works best up to 150mm). We really would like to handle larger distances than this. (But it wouldn’t be impossible to work with this range, which is why I considered it in the first place.)
  3. Peter’s electronics have denied me a 5V input voltage from the Pi. I haven’t had a good explanation as to why, and I’m pretty sure that it can be redesigned, but as it is now, I’d have to use 3V3, which would work with this sensor but make it even less reliable. (The testing I did this weekend was with another raspberry pi, where I could use the 5V pins.)
  4. Another consideration is that when I bought this first couple of sensors, they were quite cheap. In the mean time, their price has increased quite significantly. Not enough to stop me buying them if they were what we wanted, but this is another nail in their coffin…

So where to now? I’m leaning towards the HC-SR04 sensors. I already have enough in my component box to do the job with them. I’ll need to sort out the 5V pin issue in order to use them, but once that’s done, it should be fairly straightforward, I think. Need to design some sort of exo-chassis for mounting them, as due to the low height of the straight-line speed test walls, I think we’ll need to have them outside the tracks, at a low height. I’ve got a picture in my mind though, and think it will work.

But just because I want to keep my options open, I’ve also ordered a VL53L0X sensor. Another i2C one, this one with a more suitable range (up to 2m), being a laser range sensor. And as an added bonus, it happily uses 3V3 input, and you can change the i2C address (so I can have four with different addresses). It’s a bit on the pricey side, but I’ll have a play with the one and see how it compares to the HC-SR04 sensors.

Oh.. and line following. With the new battery pack, had to throttle the speed to 40% of max to get it to work, but it does:

We’ll do some work on the algorithm to smooth out the jerkiness and get it to speed up on straights, but we’re pretty happy with this.👍🏻


2 thoughts on “Battery upgrade, and proximity sensors

  1. Have you considered a 5V switching regulator? They’re more efficient and so need much less heatsinking. The RC world uses them to get 5V for receivers from LiPo batteries – in that world they call them UBECs (Universal Battery Eliminator Circuit). They can be had on ebay for about 7 quid and will take 5.5V to 26V and output up to 5A. So plenty of 5V for everything.

    On the I2C sensor – does it have a Chip Enable line? If so, you should be able to put 2 of them on the same I2C bus and switch between them with that – no need to mess about with multiplexers.


    1. The voltage regulator is the pet project of a team member; if it was I, we’d just have two separate power sources and be done with it. I’ve had no luck with that argument, and I doubt I’ll have any luck getting him to replace it with another either. In any case, the slab of aluminium solution seems to do the job, so I’m not too worried about this.

      With regards the i2C sensor, yes, it does have an interrupt pin which puts it into standby mode, so I could do it that way – I hadn’t thought of that. However I want four (one each side, one front, one back), and with other bits and pieces hanging off my pi, not sure I have enough free pins to handle this! Still, if it wasn’t for the more serious problem of not getting meaningful readings off the sensor, I’d look more carefully at this.

      Thanks for your comments, very useful food for thought.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s