During the brainstorming session, we conceived an idea of doing “The Story Box”. It’s a device with a button and an LCD display. When a user press the button, a random word is displayed on the LCD display. Simple.
Knowing that the competition requires us to use microcontroller and portable power source, we have decided to use an Arduino, powered by any 9V battery.
There are 2 options available to us:
1) Making a full blown Arduino Story Box, OR
2) Making an Arduino Shield.
We choose the latter, since Arduino of some sort are easily available. We just need a shield that can be plugged on top of an Arduino to do the job. This will also make the solution cheaper.
This translate into the following hardware specification:
16×2 Character LCD: displaying the random word.
Momentary button: the only button for user interaction.
Buzzer: acknowledging that the user has pressed the button.
I2C EEPROM: storing a list of word.
Preset 1: adjusting brightness of the LCD backlit.
Preset 2: adjusting contrast of the LCD display.
Prototype: Where the Hardwork Begins
We are divided into 3 teams: the hardware team, software team and the documentation team.
For starter, the hardware team gave the software team an LCD shield to kick start the programming effort. At the same time, the hardware teams did a quick prototyping on a breadboard.
After we were convinced that the prototype is working, we did another round of prototyping on a Protoshield.
All is well, we then started to lay out the PCB in the EAGLE Layout Editor. After a few iterations, this was what we get. Finally.
Final Product (for GGHC): By No Mean The End
Here is how The Story Box evolved: from idea, to prototype, and finally to final product for the contest.
We will not stop at here. Some members have indicated their interest in taking this further. We are very keen to see how others will use The Story Box. We very much welcome any suggestion to make this The Story Box a useful educational device.
Share this article
The whole project have 2 main software component, one is on the Arduino, the other is a uploading program on the desktop.
The Arduino software consists of a set of library and the main program.
The libraries consist of 2 part, one is the storage class, and the word generation class. They can be found at https://github.com/sweemeng/storybox/tree/master/libraries/storyboard
The original implementation of the storage class, WordStorage is using the Arduino internal EEPROM. This is while we are waiting for the Jordan finalize the I2C to external EEPROM, and waiting for the EEPROM to arrive. So this help us to create a standard interface that we use for retrieving word from storage. And we can start work early without waiting. What we learn here is there is a slight delay needed for writing into the EEPROM. Because of this, it is incorporated into the class, just so that it make things easy.
The word generation class, WordGenerator, is the main engine behind selecting words from the EEPROM. From early on we decided on using the delimiter ‘:’. During testing, our member Mats have discovered that reading a large amount of words from EEPROM can take a lot of time. This prompt us to create a simple lookup table on the beginning of the eeprom, based on the idea by Adam. The idea behind the lookup table is.
|bit 0||bit 1||bit 2||bit 3|
We allocated a amount of N * 4 byte in the beginning of the EEPROM. Each stores the beginning position and ending position of a group of word along with their delimiter which is ‘:’. In the Arduino code, we use 7. We should have around 28 bit allocated for the header. Each with the beginning position and ending position of the word group we stored into the EEPROM. And this is generated by the uploading program, not on the Arduino.
The word group is selected randomly, so instead of select a random word one by one. Then another random select on the word group is done to select a word, within the segment of EEPROM selected. . By randomly select a char within the group, and find the next delimiter, and that consider as the first character, and the next delimiter from it is the last character. We store the beginning position and ending position.
The main program then on a press of a button, call word selection, and from the beginning character, to the ending, read the character one by one from EEPROM, and send it to the LCD.
The function to write to eeprom, will just read from serial and write to EEPROM, without preprocessing, as the preprocessing is already done on the uploading program
The PC program
The GUI version of the program to upload the words to the arduino shield is not complete. But a test program that runs on python shell is completed. The reason we use python is because the time it take to write a program is shorter. It will preprocess the word group, and size. and from it, send the processed data over serial to Arduino.
What we’ve learned:
- Use serial, serial connection remain the most reliable way to send debugging information to the Arduino, it would be the equivalent to print in other programming languages.
- One of the biggest gotcha that we found is a slight delay is needed for writing to external EEPROM.
- Have access to hardware to test the code on is important. This help us to find and capture all issues early
- And have abstract out some component is helpful to get us started early too.
Share this article
Here’s the BOM list for StoryBox. For this challenge, all of the participating hackerspaces were provided USD900 by the organizer (thanks element14!). To be frank, we didn’t used up all of the money. In fact, we don’t need to use it as we have most of the components available at our space. However, we did spent some amount buying an LCD (yo element14, your LCDs are really expensive, we got a few from Jalan Pasar for less than RM20!) and a few EEPROMs.
|1||AT24CXXB-PU||1||IC1||Atmel I2C EEPROM. XX: from 01 to 1024||12.4|
|2||2N3904||2||Q1, Q2||NPN transistor||0.5|
|3||16X2 LCD Module||1||LCD||LCD module, 16X2 Alphanumeric||20|
|4||Trimmer – 1k||1||R6||LCD backlit brightness||0.5|
|5||Trimmer – 4k7||1||R7||LCD contrast||0.1|
|6||Resistor 1k||3||R2, R3, R4||0.1|
|9||Ceramic Capacitor 100nF||1||C1||Non polarity capacitor||0.1|
|11||Tact Switch – N.O||1||S1||Any momentarily Normally Open push button||0.1|
|12||Protoshield||1||Breadboard, veroboard or custom made PCB||3|
So we spent RM109, roughly USD36.
Share this article
This buildlog I’ll talk about the electronics which will drive the CNC. I did a lot of searching on ebay as well as CNCZone and have found that the most common controllers use the Parallel port as a means of communication. I was hoping the controllers would use USB but alas to add USB support to the controllers directly = spending more money. Adding a parallel port however is a cheaper alternative. Read more
Share this article
Due to some hiccup, we didn’t manage to integrate our product fully. Tonight we will resume with the integration process.
- Integrate hardware and software.
- Test the “Word List Uploader”.
- Do a demo video.
We are usually open as early as 4pm, with a break for dinner at around 7-8pm. And continue on till 10:30 or 11pm. If you want to come earlier, the best time is usually around 6:30 (before we go off for dinner)
Members of Hackerspace KL.