The code and schematic for storybox
May 4, 2011 by sweemeng · Leave a Comment
The code and schematic on the storybox can be found on github
https://github.com/sweemeng/storybox/
requirement is on the readme
Share this article
GGHC Hardware: From Idea – To Prototype – To Final Product
May 4, 2011 by kakeman · Leave a Comment
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
GGHC: The Story Box’s Programming Code
May 4, 2011 by spoonfork · Leave a Comment
The whole project have 2 main software component, one is on the Arduino, the other is a uploading program on the desktop.
Arduino Software
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 | |
| 1st | 0 | 0 | 5 | 1 |
| 2nd | 0 | 0 | 7 | 6 |
| 3rd | 0 | 1 | 0 | 1 |
| : | r | o | c |
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.
https://github.com/sweemeng/storybox/blob/master/test_code.py
Lessons Learned
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
BOM list for StoryBox
May 4, 2011 by spoonfork · Leave a Comment
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.
| No | Item | Qty | Legend | Remark | Price (RM) |
| 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 | |
| 7 | Resistor 220R | 1 | R5 | 0.1 | |
| 8 | Resistor 10k | 1 | R1 | 0.1 | |
| 9 | Ceramic Capacitor 100nF | 1 | C1 | Non polarity capacitor | 0.1 |
| 10 | Buzzer | 1 | SG1 | 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 | |
| 13 | Battery holder | 1 | 1 | ||
| 14 | Seeeduino | 1 | 70 | ||
| Total | 109 |
So we spent RM109, roughly USD36.
Share this article
Electronics Friday 29/04/2011: GGHC Build Meetup #8 (Final Push)
April 29, 2011 by kakeman · Leave a Comment
This would be the last build session where we will integrate everything.
What?
- Integrate hardware and software.
- Test the “Word List Uploader”.
- Do a demo video.
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
Share this article
Electronics Friday 22/04/2011: GGHC Build Meetup #6
April 22, 2011 by kakeman · Leave a Comment
We are almost there, hardware and software. We will have some “The Story Box” tonight.
What?
- Hardware: Etch some PCBs for The Story Box
- Software: 1. Interface with I2C EEPROM. 2. Test Python based Word List Uploader.
- Target: We will have some finished “The Story Box” in our hand by tonight.
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
Share this article
GGHC Build Meetup #5 (19/04/2011)
April 19, 2011 by kakeman · Leave a Comment
What?
- Hardware: None.
- Software: 1. Interface with I2C EEPROM. 2. Write a Python based Word List Uploader.
- Target: When a button is pressed, the LCD will display a random word (retrieve from I2C EEPROM) for 10 seconds. After that a buzzer will beep to signify the expiry time.
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
Share this article
Electronics Friday 15/04/2011: GGHC Build Meetup #4
April 15, 2011 by kakeman · Leave a Comment
Here is a prototype for The Story Board, mounted on a protoshield.
What?
- Hardware: Draw a PCB layout for The Story Box
- Software: 1. Interface with I2C EEPROM. 2. Write a Python based Word List Uploader.
- Target: When a button is pressed, the LCD will display a random word (retrieve from I2C EEPROM) for 10 seconds. After that a buzzer will beep to signify the expiry time.
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
Share this article
Electronics Friday 08/04/2011: GGHC Build Meetup #3
April 7, 2011 by kakeman · Leave a Comment
At previous GGHC Build Meetup, we didn’t finish the working prototype as planned. So we will pick up where we left off on this Friday.
What?
- Hardware: Solder a bare bone prototyping circuit on a protoshield
- Software: Write a bare bone program + interfacing with I2C EEPROM
- Target: When a button is pressed, the LCD will display a random word (retrieve from I2C EEPROM) for 10 seconds. After that a buzzer will beep to signify the expiry time.
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
Share this article
Electronics Friday 01/04/2011: GGHC Build Meetup #2
March 31, 2011 by kakeman · Leave a Comment
At previous GGHC Build Meetup, we defined the scope and milestone for The Story Box. It’s our target to have a workable prototype by the end of the meetup.
What?
- Hardware: Build a bare bone prototyping circuit.
- Software: Write a bare bone program.
- Target: When a button is pressed, the LCD will display a random word (retrieve from internal EEPROM).
When?
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)
Where?
Hackerspace KL
Who?
Members of Hackerspace KL.
And NO, this is NOT an April Fool joke. However, some April Fool pranks might happen in the space.






