![]() |
Nokia 5110 on rpi shield made out of Arduino shield protoboard, featuring some buttons, leds and a Attiny85 |
The Attiny85
On the shield I placed one attiny85 to use as analog to digital converter. It is placed on the little surface mount area and is programmed using the ICSP header next to it. I connected the SCK, MISO and MOSI to 13,12, 11 on the arduino shield. The reset is connected to the reset button.I used the High-Low Tech tutorial for bootloading the attiny85.
I must not program the attiny when it is attached to the RPi since the programmer provides dangerous 4.8V to the 3.3 rails. And I also need to remove the LCD when I program it.
I intend to communicate with serial to the attiny from the pi.
http://www.instructables.com/id/Easy-ATTiny-Serial-Communication-with-Tiny-AVR-Pro/
This contains instructions on how to use the pi's serial port
http://wyolum.com/projects/alamode/
http://raspberrypihobbyist.blogspot.se/2012/08/raspberry-pi-serial-port.html
http://www.hobbytronics.co.uk/raspberry-pi-serial-port
I run minicom to communicate with my program...
minicom -b 9600 -o -D /dev/ttyAMA0The current programming approach is quite painful so I think I will need to rethink it. maybe its time to get a 3.3V programmer or levelconvert the programmers signal?
Right now I remove the shield and LCD from the shield, connect the programmer, run arduino as sudo, write my changes and then removes the programmer, attach shield to rpi, bootup rpi and login through ssh, connect to shield through minicom to find some minor error... phew...shut down pi, start over...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(3, 4); | |
int led = 1; | |
int blinkDelay = 50; | |
void blink() { | |
digitalWrite(led, HIGH); | |
delay(blinkDelay); | |
digitalWrite(led, LOW); | |
delay(blinkDelay); | |
} | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(led, OUTPUT); | |
for (int i = 0; i< 3; i++) { | |
blink(); | |
} | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { | |
if (mySerial.available() >= 2) { | |
int c = mySerial.read(); | |
blink(); | |
mySerial.write(c); | |
} | |
} |