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:
- 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…
- 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.)
- 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.)
- 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.👍🏻