Saturday 29 October 2016

Bitty Data Logger and a Speeding Vehicle

I thought it would be interesting to see how well the new Bitty Software application Bitty Data Logger would handle capturing accelerometer data from a micro:bit attached to a moving vehicle. So.... that's what I set out to discover.

The first challenge was how to attach a micro:bit to my car! I'm no structural engineer. As you'll see. But with some good sticky tape, some glue, some rolled up cardboard and of course a piece of Lego, anything's possible :-)

There were some practical issues associated with planning this project. One person would need to drive and another hold the smartphone and operate the app whilst standing at the side of the road. I'd need a suitable stretch of road where I could drive fairly fast without breaking the law or having a horrible accident. And of course "smartphone operator" and driver would need to be able to communicate so that the driver would know when the app was connected to the micro:bit and data capture activated in the the bitty data logger app.

My long suffering wife got the job of smartphone operator, with me behind the wheel of my car. We'd devised a system of hand signals she could use to indicate she was ready and I could start driving (none of which were rude!) and I dropped her at a suitable point on a local A road, drove to the end of the road and came back around the roundabout ready to drive past her. I awaited her signal as she scanned for and connected to the micro:bit mounted on my car's wing mirror and activated data logging.

When the signal came, I immediately put my foot down and accelerated up the road in her direction. For about 2 seconds. I immediately got stuck behind another car. Yes, there was a lot of traffic about, and I did wonder what effect all those large metallic objects might have on Bluetooth radio communications.

I pulled out past the slower vehicle and put my foot down again. About 2 seconds later I was at 60mph and held that speed until the next set of traffic lights forced me to decelerate.

Don't worry - this was taken by my passenger before we started data logging!

Had the experiment worked? Had we captured any data?

Happily the answer was a big yes! The plan had been for my wife to start capturing data when I was at the roundabout about 50 metres away and driving towards her and then deactivate when I was an estimated 100 metres past her. It looks like everything worked a treat. Here's the resultant data in chart form with a manually drawn trend line which shows broadly how things panned out.

Y axis - forward acceleration

Note that this data is completely raw. The micro:bit accelerometer generates data that is somewhat "rough" and it's best used by applying a low pass filter to it to smooth out its roughness. Maybe a later release of Bitty Data Logger will give you the option to have it do this for you.

I was predominantly interested in the Y axis which represents forward motion, given how I'd mounted the micro:bit on my car, but just for good measure, here's the X (sideways) and Z (up and down) data:

X axis - sideways acceleration
My guess is, the sudden deceleration and then acceleration shown near the start of the chart correspond to me having to pull out and overtake the car that was blocking my way. After that, the general trend shows constant x axis acceleration, averaging around 0.

Z axis - up and down acceleration
The Z axis just shows vibration and general bumpiness I think!

I think I can declare today's little experiment a success!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.