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