-
Laser-cut plywood box
02/19/2017 at 00:38 • 0 commentsThe box for Simon game is designed to be laser cut from 3.2 mm thick plywood.
- Red line marks laser cuts.
- Green areas should be engraved to the depth of approx. 0.5 mm.
- Cyan areas should be engraved to the depth of approx. 1.4 mm.
- Blue areas should be engraved to the depth of 2.3 mm (M3 nut height).
Bottom wall is removable and fixed by four M3 × 16 mm countersink screws.
The M3 nuts are set in the top wall which is glued to four side walls.
Four small L-shaped parts should be glued to the inner corners of the box (to reinforce the plywood under the nuts).
Small cross-shaped parts should be glued to the bottom wall under four button switches.
Files for laser cutter are in the download section.
-
Linear-feedback shift register instead of Linear congruential generator
01/01/2017 at 19:32 • 0 commentsIn a discussion below the project review [RÖB] asked if a linear congruential generator is better that a linear feedback shift register or how are they different.
So I have tried an example for the 16-bit maximal-period Galois LFSR from Wikipedia. The result is really not bad as you can see in the pictured data (only a subtle vertical pattern can be noticed):
The Wikipedia example was slightly modified to work with seed = 0 (period of this LFSR is only 65535):
uint8_t simple_random4() { // using LFSR instead of LCG for (uint8_t i = 0; i < 2; i++) { // we need two random bits uint8_t lsb = ctx & 1; // Get LSB (i.e., the output bit) ctx >>= 1; // Shift register if (lsb || !ctx) { // output bit is 1 or ctx = 0 ctx ^= 0xB400; // apply toggle mask } } return ctx & 0b00000011; // remainder after division by 4 }
Because ATtiny13 can't use MUL instruction but linear congruential generator uses a multiplication, the linear-feedback shift register is more effective and uses 22 bytes less space in flash memory (modified source and HEX file are in the download section). So maybe I can add some additional feature in the future.
-
Development process
12/14/2016 at 00:24 • 0 commentsThe project of Simon game was developed as an electronic set for ÚDiF alias Amazing Theatre of Physics.
The aim was to create a simple toy to teach basic skills in electronics.The first version (summer 2015) was driven by ATtiny45 or ATtiny85 microcontroller, which has 4 or 8 times more flash memory than ATtiny13. It used many not-so-much effective Arduino libraries.
During winter 2015/2016 I developed a simplified version to fit into a cheaper microcontroller. But it wasn't able to store best score into EEPROM.
In autumn 2016 I decided to rewrite and optimize the program and squeeze almost all functions into 1 kB of ATtiny13 microcontroller. I made some improvements in pseudo-random generator and made minor changes in combo-keys (for re-starting best-scored game and deleting memory). I also added a demo function (infinite pseudo-random loop).