Keith vs Colour Sensor: Round 2

It has been 2 months since my last post, and for good reason. I’ve not done much to my BrickPi in that time thanks to my other university modules. But that’s not to say I’ve done nothing.

I ended my last post with my idea to get my BrickPi to behave itself with the colour sensor. That idea was to try re-flashing my board, as it could simply be my board’s firmware was faulty; so I put this idea out on the forums to see what the response was. I managed to get an AVR programmer and flash my board with no success. The idea was also debunked further when someone who had built their board from scratch themselves also had the same issue, and mentioned that another fix had worked for them.

This ‘fix’ was to do with altering the firmware, recompiling and flashing. but without the means nor the knowledge to do that, I was unable to do that. There was also the issue that the Dexter Industries firmware should work as D.I. was unable to reproduce the fault, and as far as I knew they’d not done that tweak themselves, even in the beta EV3 firmware i also tried.

The next step was looking outside the BrickPi. I’d already made sure that whenever i ran the Raspberry Pi it was plugged into a USB adaptor that could provide at least 2A, and the BrickPi itself was always plugged into the battery pack. So power wasn’t an issue.

I then asked Dave Evans if I could use the university’s BrickPi, as they had bought one after I asked about it. So armed with a second Raspberry Pi, a second BrickPi, and a freshly flashed SD card containing the Dexter Industries Raspian Image -which is designed to work out the box- i attempted every possible combination of RPi and BPi hardware to see if it was a fault on either of my boards. As you can probably guess from the ongoing theme of this post, the result was the same no matter what hardware combination I used.

This problem was starting to get ridiculous.

It was shortly after the firmware post on the forums, I received an email from John Cole, the founder of Dexter Industries. After a few emails to and fro, detailing my tests since then, it was agreed he would send me a new BrickPi board which he had tested personally and proven the Colour sensor worked on it. As he’d had it working the culprits would be reduced to relatively few, specifically eliminating firmware as an issue, assuming it didn’t work out the box.

I received the board on 5th Nov, but this was also the time when the university started laying on the work. As a result the new BrickPi board was fitted to my RPi and promptly forgotten about while i did other work.

Fast forward to today, when i finally found time to test the BPi.

While I had been taking to John, he (or someone at D.I.) had updated the sensor tests to include one for the colour sensor’s other mode: as a simple Red, Green or Blue LED lamp. So I had two tests to run.

In order to start from fresh I prepared my SD card with a fresh install of the D.I. Raspian image. Before i did anything with the sensors I had some setup to do:

  1. Connect the Pi to my WiFi
  2. Used raspi-config to expand the filesystem and change the keyboard layout to English (UK)
  3. Reboot
  4. “sudo apt-get update”
  5. “sudo apt-get upgrade”
  6. go to the BrickPi_Python directory and run “git pull” to grab the new tests and any fixes.

After checking i was plugged into the right port I ran both tests on both of my colour sensors.

My BrickPi

Checking the sensor port

First I ran the test that had been plaguing this issue, the colour sensing test:

DSCF0113 (Large)

I knew it wouldn’t be that easy….

The test didn’t work, as had been the case through this entire debacle. I had been optimistic that this would work as John had sent me photos of this working, but at the same time I had the feeling that it wouldn’t be that easy.

I still ran the new LED lamp test, just in case:

The LED lamp test

It worked!

Running the test, the lamp lit. FINALLY! We were getting somewhere. Or so i thought…

Lamp is still lit

The program had been terminated

I terminated the program using the Ctrl-C keyboard interrupt to find that the sensor remained lit. I turned it off by physically disconnecting it, and reconnecting it

So there’s a minor victory in that the lamp test works with a minor issue, but the all-important sensing test is still as stubborn as ever.

I’m now of the opinion that the issue is due to something on the Raspian OS and D.I. image of the OS. As that is literally the last thing to check having eliminated the sensor hardware, the BrickPi firmware, my Raspberry Pi and my sensor cables. It could simply be that something isn’t being set up correctly.