Bike Lidar and Social Distancing Alarm.

Time is strange at the moment, but weekends are still a good time for project building. So over a few weekends this project evolved and turned into two projects.

The main project came about as I wanted to a) try a VL53l1X time of flight/Lidar device b)write some  Bluetooth LE code.

The result was this board (breadboard prototype shown in pictures) and an mobile application.

As a standalone board the “Ninelocks Bike Lidar” (all projects need a name ) can sound an alarm when an object is within a certain distance. But to make it more adjustable I gave it an Bluetooth LE GATT profile so it can be configured from a phone or other Bluetooth LE device. That meant writing an phone application as well.

The phone app shown here the phone gets updates from the Lidar board and logs the current distance along with timestamp and GPS location data and for eye candy shows the most recent reading on a graph.

The phone can also sound an alarm if anything gets closer than the distance set as the trigger threshold. There is a ‘video’ below showing the device and application at work with some suggested uses.

In its bike guise it could potentially warn you of vehicles behind you (ok only up to 4 meters away and its still being tested but….) as a social distance alarm it can live on your desk to warn of approaching colleagues/ potential infection vectors.

You could maybe use it to check if you wheel have wobble or any other lidar/distance/graph  type things you can think of. Code will eventually make it to github.

The Application

There is a video (aka vid-ay-oh as they say in stoneybridge)

Video of Lidar Board

Posted in arduino, coding, computing, cycling, music | Tagged , , , | Leave a comment

Midi System Exclusive Control of Arduino Application

Most recent project has been an midi foot controller based around an Arduino/PJRC Teensy and a companion windows application to configure it.

Details and source over at github

The configuration tool in Windows(Works in wine on Linux)

Sysex Format

The sysex format is in this format.
   System Exclusive Configuration Messages

Configuration of the project is by Midi System Exclusive MEssages, the format of which are now described

The midi header counting from byte 0

0 0xF0 Start of sysex
1 0x7D indicating research/school/not  a manufacturer
2 0xNN 4 Character key , the same in the arduino application
3 0xNN
4 0xNN
5 0xNN
6 0xMM A device ID, you choose identify your arduino project
7 0xMM A Command 
. Variable number of bytes depending on message
. 0xF7 End of SysEx marker

The 4 character code is set in the arduino source and can be configured in the windows pedal manager (see its documentaion )

  Request arduino send out its current configuration

0 0xF0 Start of sysex
1 0x7D indicating research/school/not  a manufacturer
2 0xNN 4 Character key , the same in the arduino application
3 0xNN
4 0xNN
5 0xNN
6 0xMM A device ID, you choose identify your arduino project
7 0x02 Command 0x01 is send config
8 0xf0 End of SysEx marker

On receipt of correctly formatted message the Arduino should reply

 0 0xF0 Start of sysex
 1 0x7D indicating research/school/not  a manufacturer
 2 0xNN 4 Character key , the same as in the arduino application
 3 0xNN
 4 0xNN
 5 0xNN
 6 0xMM A device ID, you choose to identify your arduino project
 7 0x02 indicates this is response to a "give me your configuration" request 
Posted in arduino, coding, computing, midi, teensy, Uncategorized | Leave a comment

SQL and secure_file_priv

Reminder of how to export from mysql when you run into the secure_file_priv message!

to find what its set at currently from within sql

SELECT @@global.secure_file_priv;

to export stuff to csv


Posted in coding, computing, mysql | Leave a comment

Logitech C270 and Linux hangups

Problems on a debian install that each time I plugged in a C270 the usb hung.

A look at logs showed two symptoms. lots of
usb 3-6: 3:1: cannot get freq at ep 0x86
and multiple instances of udevd also lsusb would hang.

Reason is the audio, quick fix is to unload usb audio module
rmmod snd_usb_audio so later today I may get round to writing a udev rule,

Posted in coding, opencv, Uncategorized | Tagged , , , | Leave a comment

OpenCV 3 and ffmpeg fun

Had a few hours of  ‘fun’ getting OpenCV3 to build… I will expand on that sometime, meantime some reminders

Some reminders mainly to me…

The main problem was configure for OpenCV would not find ffmpeg, in spite of all the solutions to the problem posted around the web, none worked. In the end I reinstalled OpenCV from source.

Note below the configure needs some specific flags or open CV will get grumpy.


clear build folder with rm -r

#before doing the




ffmpeg build required

./configure --enable-nonfree --enable-pic --enable-shared

You may find ffmpeg complains when it is run of missing libraries, its the usual solution apt-get….

A couple of functions I use from older version has different args, for thos a quick fix os

#contours returns more values so…
(_,contours,_) = cv2.findContours(
contours, hierarchy = cv2.findContours(…)[-2:]
[/sourcecode ]

ps for the java libs it doesnt find thing unless

export JAVA_HOME=/usr/local/jdk1.8.0_20


Posted in computing, opencv, python | Tagged , , | Leave a comment

From mbed online to mbed-cli via KDS and LPCXpresso

After an exciting few weeks with projects using 11u35/1764 and K64F with lpcXpresso and Kinetis Design Studio I have yet to find a good working IDE for ALL of them. So as the online tools have been slow this week I have resorted to mbed-cli command line tools.

The export as zip option has been removed from the online tools so I have used either export to LPCXpresso or as a GCC project.

So here are  the steps:-

1)download as expresso or gcc export
2)unpack into folder
3)cd into folder
4)mbed new .
5)modify mbed.bld to

(theres a post about this at )
6)mbed deploy

it then complains about libraries references

[mbed] ERROR: Library reference “MPU6050.lib” points to a folder “/junk/jt_mbed_cli/nl_DEV_datalogger_nolib/MPU6050”, which is not a valid repository.
[mbed] ERROR: You can remove the conflicting folder manually and use “mbed deploy” to import the missing libraries
[mbed] ERROR: You can also remove library reference “/junk/jt_mbed_cli/nl_DEV_datalogger_nolib/MPU6050.lib” and use “mbed sync” again.
To work round this is is up to you I just deleted the libs and then doing
step 7 to get them to download again was easiest
7)mbed deploy

8) mbed compile -t GCC_ARM -m LPC1768

In a later post I will explain how I then got mbed-cli to actually export something for KDS and LPCXpresso and the fun it was getting them to compile…

If you have an easier way, please drop me a line

Posted in coding, computing, MBED | Leave a comment

Reminder how to Program an MBED 11u35 from Linux or mac

For a work project I am using an embedded artists 11u35. These notes are reminder of how to download code to it when on mac or linux…

Note below taken from this link on mbed forums by Neil Thiessen

a)remember to start the boat up by keeping left button pressed while pressing reset. (assuming usb is top)
b)will appear as device called CRP_DISABLED

For Mac or Linux:

delete firmware.bin
unmount device (sudo on MAC)
using Linux umount /dev/sd* (where * is the location of your device)
using Mac OS umount /volumes/CRP DISABLD

copy the file to the disk
Using Linux dd if=mbed_if.bin of=/dev/sd* seek=4
Using Mac dd if=mbed_if.bin of=/dev/disk* seek=4

Posted in coding, computing, MBED | Leave a comment