BUGGY: Beginner’s Guide to Flowstone Graphical Programming
WHAT IS BUGGY?
Buggy is a programmable vehicle development kit, consisting of a 4WD buggy with headlights, brake lights and blinkers/indicators, a microprocessor brain, plus up to five MikroBus sockets to plug in various sensors and displays, etc., from MikroElektronika’s ever expanding range of Click Boards. It also has an on-board battery charger via USB and a powerful Lithium battery that will give you hours of fun. The kit comes partially assembled with the motors already attached, however, there is some soldering required to finish the construction which all adds to the experience.
You get a choice of microprocessor brain when you order to plug into the Buggy main board from around fifteen different processor/display combinations. There are options using microprocessors such as PIC, STM, Stellaris, Tivia, Xmegga, PSoC, as well as with or without a TFT screen, etc. We used the Clicker 2 with an STM32 microprocessor which is the same processor we used on our own FlowPaw board.
Communication to the Buggy is via Bluetooth using either the BLE (Bluetooth Low Energy) Click Board or the standard Bluetooth Click Board. The Buggy also comes with a demo app. for Android devices that support Bluetooth 4 (BLE) which is great fun, but we wanted to connect the Buggy to our PC so we could control it from FlowStone so we used the standard Bluetooth 2 Click board that was compatible with our laptop. Not all devices support BLE yet, but you have a choice when you order.
The Android app. is a great place to start. There is some demo firmware for the STM32 Clicker 2 board that handles the Bluetooth Coms and controls the motors and lights etc. Then it’s just a case of downloading the Android app, pairing the Bluetooth and you’re away. You can then drive the Buggy around using your finger on the tablet/ phone screen, etc. The source code of the app. is also available if you want to use this as a basis for programming; however, in our case we will be using FlowStone.
BUGGY & FLOWSTONE
Our aim was to control the Buggy from FlowStone so we could quickly write some intelligent interactive code to control it, but before we could start, we needed to tweak the firmware for the Buggy to use the standard Bluetooth Click Board to work with our laptop. To do this we needed the C++ compiler from MikroElektronika which is free to use for small projects and is one of the best there is. There are lots of powerful libraries built in ready to use and a very elegant IDE (Integrated Development Environment). All of the firmware is open source and there are plenty of code examples on the LibStock developer community (www.libstock.com). With the firmware tweak done we then need- ed to send commands from FlowStone on the PC to the Buggy over the airwaves. To do this we used the trusty Xbox games controller to capture our physical movements and then used FlowStone to decode the movements and send out the correct commands via a simple comport to the PC Bluetooth interface.
Our FlowStone code has three main modules. The first has the Xbox module that reads the Xbox joy sticks and buttons via USB. The second decodes the buttons into the correct binary string to control the lights (Side Lights, Head Lights, Right Blinker, Left Blinker, Brake Lights). The final module houses the Comport module that sends the data to the Bluetooth serial driver. Using this simple FlowStone code we were able to drive the buggy around using the Xbox controller plus switch on the lights and blinkers within a matter of minutes. We even programmed it to put on the brake lights when the Buggy came to a stop, etc.
Now that we have the basic control of our Buggy we can start looking at programing some intelligence into it. For example, using the Proximity Click board facing forward you can detect obstacles and start to develop some autonomy. You can add an 8×8 LED matrix display Click board to write messages as it drives by or add a GPS Click and Compass and send it way points to navigate to, etc. The possibilities are endless.
The Buggy is a great tool for learning how to code physical devices and gives you many options on processors/displays and connectivity. To get the most out of it you really need to program two things, the Buggy Firmware and some form of control device, whether that be an Android device (tablet or phone) or a PC using FlowStone in our case. The great thing is that you can start simply and then get as complex as you like with the Buggy. The beauty of using FlowStone is that you can see the code working in real-time which speeds up the development cycle to no end. The Buggy really is great fun and is very engaging. Available now from $119.