Here in this project, I will show you only one example of how these computers can be utilized in a productive way. I called this project as SmartBox, I admit I wasn't a creative guy thinking of a name but it will indeed serve as a small computer that can do many jobs. As a first application, I will use that box to show tweets, e-mail notifications and current time on its LED scrolling display. I will also notify status with a blinking RGB Led fading in and out attached to the back side of the box.
In this tutorial, I am going to start from scratch. I will first show you my first design on paper and the idea behind it. Then, I will move on to the electronics design of the product, namely, LED Scrolling Panel, Power LED Driver, Circuit to drive LED Panel etc... In the next phase, I am going to share my product design sketched in Google SketchUp. And lastly, I will show you how the software works.
I don't expect you to do the same of this project but I am hopeful that it will inspire you for other way cooler projects in which BeagleBone can be used.
Step 1: First Sketches on Paper
First, there should be some limitations on my design. In the front side, scrolling led panel will show tweets and it would be more stylistic if that led panel doesn't cover too much space. Therefore I planned to make rotating/adjustable led panel on the front side. On the back side of the module, there should be enough space to place Beaglebone, Led driver circuit, and some extra space to place extra usb stuff - such as - wireless dongle, 3G modem etc...
I have intentionally designed a small box and also slim one because it looks prettier. Here is my first sketches:
Step 2: Electronics Stuff
I designed and produced the scrolling LED panel with the facilities on my hand.
For the scrolling led Panel, I used:
5x7 Dot Matrix Led Panel (x6)
MBI5026 16-bit Constant Current LED Sink Driver (x2)
BC307 General Purpose PNP transistor (x7)
I am feeding the data for each row serially by using the 16-bit shift register(MBI5026). Please note that MBI5026 can only be used as a current sink, so it cannot source current.I used seven transistors to source the current for each row. I am controlling the transistors and also serial data for each row with arduino.
PCB design is also attached to here. Note that, dot matrix panels have so many connections which is I can't design one layer pcb without using jumpers.
For the RGB Power Led at the back side:
Power Leds draws high current so that they need special driver circuits. There are different possibilities to construct such driver circuit. Easiest one is to use some kind of current sink and very small resistor. ULN2003 has 7 current sinks inside. Connect the positive terminal of the leds to positive supply and negative terminal to the terminals of the ULN2003 with series resistors, respectively. I'm using 1ohm in order to limit the current for PowerLeds. If we assume that, Led draws 300ma, there will be 300mV of voltage drop on the resistor which is small enough to power the led.
Input terminals of the ULN2003 is connected to arduino pwm pins so that I can adjust the brightness and the color of the led using arduino. You can make really cool fading effect using rgb leds.
Arduino will also play a role between Beaglebone and the Scrolling Led panel. Connection between Beaglebone and Arduino is serial connection. I didn't want to burn up my Beaglebone accidentally, therefore I used ardunio for all the stuffs which requires relatively high current. As I am done with all the design, I will dump the arduino part, hopefully...
Step 3: 3D Model Design in SketchUp
In order to design 3D model of the module, I used Google SketchUp. I like sketchUp, it is easy to use and you can even create very complex models. Here is the final sketch in sketch up.
After being done with the sketch, I made my sketch cut by laser cutter. I used acrylic as a base material.
And here is the assembled version of the parts. Doesn't it look nice ?
Step 4: Assembling All the Parts
Next step is to assemble all the parts produced before. These are the scrolling text panel, buttons on the text panel, BeagleBone, power led for notifications and the microcontroller(basically hand-made arduino) part to drive scrolling text. Here is the assembled final version of the SmartBox.
Step 5: Software
The main features that I want in my SmartBox are:
1) Displaying tweets fetched according to hashtags specified by user beforehand.
2) Notifying user if there is a new e-mail in their gmail inbox and displaying the subject on the screen
3) Displaying time on the screen if the user presses the button on the front panel
I wrote all the codes in java. In order to fetch tweets I used Twitter4j API. And to connect to gmail, used Java Mail API. Time information is also fetched from internet. Related packages and my source code is attached below. All these codes are written for beaglebone side. I wrote all the java code in Eclipse in my computer, then I transferred the compiled java classed to my beaglebone as writing java codes directly in beaglebone console is very hard and irritating job.
There is one more thing to upload program to it, Arduino. Arduino is responsible of listening the serial port for the commands show tweets, gmail notifications and current time. If it gets any command from Beaglebone through serial port, it displays received information on the scrolling panel. Also you can change which information you want to see by pressing the button on the front panel. Arduino also includes codes for character sets, and code for piping characters into two shift registers which are connected to dot matrix panels.
I faced many different issues as I develop code for my arduino and beaglebone. First issue was that Arduino didn't have enough memory in SRAM to store all character set. I solved that problem by storing character set in the flash memory by using PROGMEM identifier in Arduino. Might be trivial but it took my days to identify problem :) it was first time for me to reach limits of Arduino (:
Other problems I faced are more high-level problems compared to one I faced in Arduino. How can you tell to BeagleBone which hashtags it should use? At first, I installed a server using python which presents user textbox and want to enter a hashtag. However, we need to know IP number of the beaglebone to reach beaglebone which might be problematic if the IP is not static. Then I found another solution, using free webservices on the net, which provides users basic API to submit and request information on their server. GUBB.net is one of them. They provide you an API key and using this API key you can store list like structural information on their server. Smartbox users can submit desired hashtags on that side, then BeagleBone will fetch the hashtag data using the API key.
In order to communicate with Arduino, BeagleBone needs to send serial commands. Break-out pins on BeagleBone can be used for different purposed. If you want to use them as serial port, you need to set MUX Settings before hand. Here is short tutorial on how to do that: http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/
And the last part is connecting BeagleBone to internet. There are many possibilities to do that: You can either use LAN cable or wireless modem. Or there is even more elegant solution which is using 3G modem. I am using 3G modem to connect internet so I don't need to connect SmartBox to any thick LAN cable and I don't need to set up wireless network neither. Using 3G modem in your beaglebone might not be a trivial job but keep trying :) and ask me if you need help :)
Step 6: Start the Machine!
That's it! We have now a working copy of an SmartBox here :) I am not sure if I will have a chance to produce more of it because I spent lots of time on it and I am criticized from time to time saying that screen is so small, why I need to use that module instead of using twitter in my smartphone etc... I do have some answers for all these criticism, but I leave final decision to all you guys :) As I said in the beginning, this is a good example of utilizing beaglebone in your hands and make you informed and experienced in many points as you develop your product.
Now, it's time to see out SmartBox at work :) In the video, it displays tweets related to hastags specified by user. Then, I show where and how you submit other hashtags using website gubb.net. Then, I send an e-mail to smartbox gmail account and wait for to see e-mail notification :) power led at the back fades out and in if there is new tweets or new e-mail as you can see from the video.
[I would like to thank Salih Ergut, Omer Faruk Kurt and Burak Aykut Sungur for their encouragement, understanding and guidance throughout my project. I am also grateful to Avealabs due to facilities provided to me]