open-source firmware to control color LEDs (or other things) with USB-enabled RouterBoard

As a hobbyist exercise, I created a way of controlling external devices via a Mikrotik router. The usage I employed was controlling an array of color LEDs. However, it could also be relays, meter movements, door locks, etc., etc.

RouterOS has the ability to send SMS messages:

http://wiki.mikrotik.com/wiki/Manual:Tools/Sms

I saw this feature as a mechanism to make it possible for Mikrotik devices to send control messages to external embedded devices via USB.

I used a $1 PIC16F1454 USB microcontroller to implement just enough of the 3GPP specification to make RouterOS believe that it is communicating with a GSM modem.

The microcontroller can then interpret the SMS message as a command for whatever the designer envisions using it for.

As written, letters ‘a’ through ‘z’ correspond to a rainbow from violet to blue to green to yellow to orange to red. The character ‘>’ is a special command to shift all the LEDs over by one.

Here is an example Scheduler script (running at a time interval of choice); I’m not a RouterOS scripting expert:

/interface monitor ether1-gateway once do={
:local rxrate ($(“rx-bits-per-second”) / 10000);
:local lookup “hijklmnopqrstuvwxyz”;
:local smsmsg “>$[:pick $lookup $rxrate]z”;
:set smsmsg [:pick $smsmsg 0 2];
/tool sms send usb1 “” message=$smsmsg
}

The script writes an SMS message of the form “x>” where x is a letter from ‘h’ (blue) to ‘z’ (red). ‘h’ represents no receive activity; ‘z’ represents max receive throughput. Each time the script runs, the PIC16F1454 firmware shifts all the LEDs over by one and the newest value is added. So, at a glance, one can see the traffic load on the router.

I’ve made the firmware code open source, and it is available here:

https://github.com/majbthrd/miksms

The schematic of the hardware used is here:

https://github.com/majbthrd/somepixel/tree/master/hardware
miksms2.jpg
msomepixel.jpg

:open_mouth: that’s clever!

That microcontroller looks like a mass-produced one, are you going to sell them?

Thanks! I did the PCB as a one-off.

I would like to see the USB bootloader employed in the project make its way into a mass-market product:

https://github.com/majbthrd/PIC16F1-USB-DFU-Bootloader

I think it would make for an inexpensive board that could get reprogrammed via USB to do all manner of things, including something like the project above.