2015-10-31 12:11:33
#Nyan Board by @Radomir Dopieralski
[UPDATE] Video and code added
So this should be an easy one, right? Oh how I failed. I'm still not getting sounds out of it, after I played around with libraries and different Versions of arduino. It's always tones and timers that get me.
I first thought the pads next to the attiny45/85 where a pullup resistor - d'oh. Of course it didn't do anything. Now it at least blinks.
To fit on an attiny45 I had to change the code a bit.
this code works, see the comments:
const int LENGTH = 27;
const int NOTES[] PROGMEM = {
65, 67, 70, 67, 74, 74, 72, 65, 67, 70, 67, 72, 72, 70, 69, 67, 65, 67, 70,
67, 70, 72, 69, 65, 65, 72, 70
};
const int DURATIONS[] PROGMEM = {
25, 25, 25, 25, 75, 75, 15, 25, 25, 25, 25, 75,
75, 75, 25, 5, 25, 25, 25, 25, 100, 5, 75, 25,
100, 5, 100, 200
};
void play() {
float bps = (60.0 / 120) * 1000.0;
for (int i = 0; i < LENGTH; ++i) {
int note = pgm_read_word_near(NOTES + i);
int duration = pgm_read_word_near(DURATIONS + i);
int hertz = (int) (pow(2.0, ((note - 69.0) / 12.0)) * 440);
tone(4, hertz, (long) (duration * bps / 100) - 10);
delay((long) (duration * bps / 100));
toggle_eyes();
}
}
void toggle_eyes() {
PORTB ^= ( 1 << PB3 );
}
void setup() {
DDRB = ( 1 << PB3 );
DDRB = ( 1 << PB4 );
}
void loop() {
play();
}
#include "pitches.h"
#include <avr/pgmspace.h>
const int FREQ[] = {
REST, NOTE_AS4, NOTE_AS5, NOTE_B4, NOTE_B5, NOTE_CS5, NOTE_CS6, NOTE_D5,
NOTE_DS4, NOTE_DS5, NOTE_DS6, NOTE_E4, NOTE_E5, NOTE_E6, NOTE_FS4,
NOTE_FS5, NOTE_GS4, NOTE_GS5,
};
const signed char INTRO_NOTES[] PROGMEM = {
9, 12, -15, -4, 9, 12, 15, 4, 6, 10, 6, 2, -4, -15, 9, 12, -15, -4, 6, 2,
4, 6, 13, 10, 13, 4, 0
};
const signed char MELODY_NOTES[] PROGMEM = {
-15, -17, 9, 9, 0, 3, 7, 5, 3, 0, -3, -5, -7, 7, 5, 3, 5, 9, 15, 17, 9, 15, 5,
9, 3, 5, 3, -9, -15, 17, 9, 15, 5, 9, 3, 7, 9, 7, 5, 3, 5, -7, 3, 5, 9, 15, 5,
9, 5, 3, -5, -3, -5, -15, -17, 9, 9, 0, 3, 7, 5, 3, 0, -3, -5, -7, 7, 5, 3, 5,
9, 15, 17, 9, 15, 5, 9, 3, 5, 3, -9, -15, 17, 9, 15, 5, 9, 3, 7, 9, 7, 5, 3, 5,
-7, 3, 5, 9, 15, 5, 9, 5, 3, -5, -3, -5, -3, 14, 16, -3, 14, 16, 3, 5, 9, 3,
12, 9, 12, 15, -3, -3, 14, 16, 3, 14, 12, 9, 5, 3, 14, 8, 11, 14, -3, 14, 16,
-3, 14, 16, 3, 3, 5, 9, 3, 14, 16, 14, -3, 3, 1, 3, 14, 16, 11, 12, 9, 12, 15,
-3, -1, -3, 14, 16, -3, 14, 16, 3, 5, 9, 3, 12, 9, 12, 15, -3, -3, 14, 16, 3,
14, 12, 9, 5, 3, 14, 8, 11, 14, -3, 14, 16, -3, 14, 16, 3, 3, 5, 9, 3, 14, 16,
14, -3, 3, 1, 3, 14, 16, 3, 12, 9, 12, 15, -3, -5
};
#define BEEP_PIN 4
#define LED_PIN 3
#define SPEED 1500
void toggle_eyes() {
static bool blink = false;
digitalWrite(LED_PIN, blink);
blink = !blink;
}
void play(const signed char *notes, const unsigned int length) {
for (unsigned int n = 0; n < length; n++) {
signed char f = pgm_read_word_near(notes+n);
int d;
if (f < 0) {
d = SPEED / 8;
f = -f;
} else {
d = SPEED / 16;
}
tone(BEEP_PIN, FREQ[f], d);
delay(1.3 * d);
noTone(BEEP_PIN);
toggle_eyes();
}
}
void setup() {
play(INTRO_NOTES, 26);
}
void loop() {
play(MELODY_NOTES, 216);
}2015-10-18 00:50:25
this might just be my bad luck, but I really get frustrated with all my raspberry pis... I've ordered some faster cards but seriously suspect my rPi B+ to fail. Is there a number out there on how fast the controller of the PI can read SD cards? Is it worth to grab fancy class 10 cards? Let's see how the new image works.
25MB/s throughput and most likely 22MB/s - class 10 is fine then....
in a nutshell: the newest image of raspbian from september doesn't work well with dd, I always end up with 1byte more at "records in" which made the 2nd partition a no-show.
Now inspecting the SD cards for faults by following this (hopefully) awesome tutorial, using F3.
http://www.broes.nl/2012/08/verify-the-integrity-of-a-flash-sd-card-on-a-mac/
First card output makes me think that my card is fine but my raspberry PI is not :(
wake:AltraMayor-f3-795424c davedarko$ ./f3write /Volumes/UNTITLED/
Free space: 3.74 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... OK!
Creating file 3.h2w ... OK!
Creating file 4.h2w ... OK!
Free space: 0.00 Byte
Average writing speed: 8.65 MB/s
wake:AltraMayor-f3-795424c davedarko$ ./f3read /Volumes/UNTITLED/
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 2097152/ 0/ 0/ 0
Validating file 3.h2w ... 2097152/ 0/ 0/ 0
Validating file 4.h2w ... 1556288/ 0/ 0/ 0
Data OK: 3.74 GB (7847744 sectors)
Data LOST: 0.00 Byte (0 sectors)
Corrupted: 0.00 Byte (0 sectors)
Slightly changed: 0.00 Byte (0 sectors)
Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 17.19 MB/s
| Company | Class | Size in GB | avg. writing speed | avg. reading MB/s | State |
| Transcend MMBGF 04GWACA-MG | 6 | 4 [3.74] | 8.65 MB/s | 17.19 (16.89) | OK |
| Samsung MB-SS4GVBGBAA-RD | 4 | 4 [3.69] | 3.08 MB/s | 17.69 (18.41) | OK |
| Samsung MB-SS4GVBGBAA-RD | 4 | 4 [3.69] | 3.29 MB/s | 17.41 (15.64) | OK |
| No brand microSD E408G1349 | 6 | 8 [7.20] | 4.31 MB/s | 17.10 | 96KB / 192 sectors lost |
| Intenso | N/A | 4 [3.69] | 5.62 MB/s | 11.91 | OK |
| Hama | 2 | 4 [3.67] | 2.90 MB/s | 11.84 | OK |
| SanDisk | N/A | 2 [1.84] | 5.46 MB/s | 9.78 | OK |
| Toshiba | N/A | 1 [0.98080] | 4.42 MB/s | 12.23 | OK |
| Transcend | 10 | 16 [14.97] | 7.55 MB/s | 16.92 (23.59) | OK |
| Transcend | 10 (UHS-1) | 8 []
| | | |
| | | | | |
So only one card shows corrupted sectors. The newest Raspbian image does not like me (dd throws in 1 byte too many). Arch Linux seemed to work and also openELEC. With the new ordered SD cards [16gb class10] and [8gb uhs-1] I have 9 SD cards I can work with. Interesting to see how fast they can actually go and some results are surprising, like the crappy 8GB card and the speedy transcend. I'll try the 16GB tomorrow and also check out the BTRFS Raid1 mode. I might get 2GB for the system and 6GB data storage out of it.
* Seems like the SD card reader integrated in the MacBook Air 2010 is a bit slow, so I started reading the cards again with a Transcend USB 3.0 dongle on the USB 2.0 input. The new data is in brackets.
More links for preventing corrupting SD cards / FS from raspberry PI
http://www.ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/
maybe even use the SD card only for the boot fs and use a usb stick for data etc.
https://www.talksharp.com/how-to-prevent-the-raspberry-pi-from-corrupting-sd-cards
"[...] read-only mode. If there's nothing being written to your SD card, it won't get damaged no matter what you do."
http://raspberrypi.stackexchange.com/a/8038
"The best resistance against corruption on a single SD card would be offered by BTRFS in RAID1 mode with automatic scrub run every predefined period of time."
http://unix.stackexchange.com/a/186954
What should I do with SD cards that are corrupted?
2015-10-08 00:42:12
[UPDATE] print is done :) Check the bottom of this page.
Still recovering from that weekend. My first maker faire, a "have to", because it was in Berlin, my hometown.
Friday night I was meeting with @WooDWorkeR, @Sophi Kravitz, @Elliot Williams and @al1 at the c-base. Shamefully I have to admit that this was my first trip to the space station based in Berlin, a meet-up place for computer friends, aliens, geeks and nerds and guys with no labels and categories. The tour offered some inspirations for new hacks and we've seen the #warpcore go crazy. Two notable projects that stuck in my head were the little speaker box, that made spherical noises when picking up magnetic fields (telephone amp by a company called micro-electric) and the 4 EL-Wire tube that looked like it was pulsing (no pictures were allowed to be taken, sry). We met other guys that wanted to check out the c-base before going to the maker faire and had a great time.
I think the speaker was based on something like this: http://www.jameco.com/jameco/workshop/diy/magnetic.html
Saturday I've met @al1 at the Ostbahnhof station near the Postbahnhof to go to the maker faire. Greeted by a fire throwing container robot we entered the first floor where some were still preparing their tables. I'm working through the flyers, they aren't in order.
MakerBeam
The first thing that got me interested was the MakerBeam starter kit. There was definitely a lot inside, different length of 1cm x 1cm extruded aluminum profiles with a threaded hole all the way through and multiple connectors to create presentable prototypes.
www.makerbeam.com - www.makerbeam.de

Seedstudio
they brought prototypes of their RePhone and Stickers and buttons and many staff.
https://www.kickstarter.com/projects/seeed/rephone-kit-worlds-first-open-source-and-modular-p
Hartmut Wendt
He brought a din rail case for the raspberry Pi, a mini arcade case and a lot of other little boards that we had a good chat about.
www.hwhardsoft.de
Inspirational projects
www.hacklace.info - a tiny orange 8x8 matrix driven by an atmega328, arduino compatible - everything in a necklace form factor. I was close to buying one but have so many displays in that size, that I would be angry with my self. Another interesting device was the word clock by www.kellys-finest.de that were designed with common ebay classics like a chead arduino clone, 2 8x8 matrices with max7219 controller and a DS1307 module. And there was this beauty:

Pimoroni
they brought a lot of hats (shields, stacking stuff) for the raspberry PI and they might have thought that I was writing for hackaday.com - I had to wear a HaD shirt. There was a lot of RGB stuff going on!
http://shop.pimoroni.com
Lasercutting and front plates
there were some service sellers that caught my eye. www.formulor.de and www.schaeffer-ag.de were there, and also http://pro.john-steel.com - beautiful interface and good pricing.
---------- more ----------
3D printing
http://i.materialise.com - first price test looks like prices of only 25% percent of shapeways for plastics. MeltWerk had some interesting prints as well, with prices around 75% of shapeways, tested with the same object. If you have a lot of LEGO parts, a browser and not so much time to wait for your 3D prints, you might want to take a look at www.brickify.it - there you can replace easy structures with LEGO parts to save time.
freie Maker
I'm printing myself right now - thanks to the guys from http://freie-maker.de - they brought a 3D scanner and scanned everyone who was interested - should have pulled in my belly :D After scanning a receipt with a link was printed and you have full control over the data. Awesome! We also met @Mario Lukas there and had a little chat.

After seeing the Siegessäule and the vintage computer festival, @al1 and I sank into the couches until the party started. We got our ESP8266 boards out, I brought my #zynthia - sequencer synthesizer and #USB cable tester - @al1 brought his #tiny7 displays. We had some great chats with a couple of guys that were drawn to us by my #RGB 16 Segment LED . We also met @Krzysztof Wrzalka and @Daniel Rojas who brought his two projects, the #Uranium Marble Ring Oscillator and the #Micro Word Clock
@antti.lukats brought some #DIPSY pcbs for everyone (that BGA stuff is tiny!) There was also a guy from the netherlands, who traded a devalued coin for one of my #Lithium Coin Cell charger boards.
I had a great time and exactly one club mate caipirinha too much - should have taken more photos.
