im creating a voltage adjusting driver pcb board using a joy stick to control the voltage level and direction of polarity im planing on burning some simple code to the attiny85 and soldering it right to the pcb board with the analog joy stick to processes its output values i have it all set up on a bread board working fine with an mega 2560 arduino board now i want to use this videohttp://www.youtube.com/watch?v=30rPt802n1k to guide me to programing attiny85 using the mega and the replace the mega hooked to the bread board with attiny 85 to test that this is what i want before i solder it to the pcb board
things im looking to know
is there a min voltage on the attiny85
should i buy a 5v regulator to run it
do i need the 16.000mhz crystal like the uno and mega use ?
will the code im using be supported by the attiny ?
im going to go down load the data sheet for most of my info right after i hit the post button but if any one has any info or in put on this please let me know .
code i plan to use>
const int analogPin = A0;
const int derictPin = A0;
// pin that the sensor is attached to
const int ledPin = 50; // pin that the LED is attached to has derction of dc motor relay
const int threshold = 600; // an arbitrary threshold level that's in the range of the analog input
int toggle = 40; // motor on / off
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(toggle, OUTPUT);
// initialize serial communications:
Serial.begin(9600);
}
void loop() {
// read the value of the potentiometer:
int analogValue = analogRead(analogPin);
// if the analog value is high enough, turn on the LED:
if (analogValue < 405) {
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
analogRead(analogPin);
int analogValue = analogRead(A0);
analogValue = map(analogRead(A0), 440, 0, 255, 0);
digitalWrite(ledPin, HIGH);
analogWrite(12,analogValue/4-60);
digitalWrite(toggle, HIGH);
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
delay(30);
}
else if (analogValue > 505)
{
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
analogRead(analogPin);
int analogValue = analogRead(analogPin);
analogValue = map(analogRead(A0), 450, 1023, 255, 0);
analogWrite(12,analogValue/4-60);
digitalWrite(ledPin,LOW); // led pin toggles revers polarity of dc motor relay for now
digitalWrite(toggle, HIGH);
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
delay(30);
}
else
{
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
analogRead(analogPin);
int analogValue = analogRead(analogPin);
analogValue = map(analogRead(A0), 431, 449, -1, 1);
analogRead(analogPin);
digitalWrite(toggle,LOW);
// print the analog value:
Serial.println(analogValue);
analogRead(derictPin);
Serial.println(derictPin);
delay(30);
}
}
The tiny has a wide range if you can use lower speeds. You don't need crystal it can run at 16mhz with its internal oscillator. Consider having an ISP connector on you Pcb so you can re-program when needed.
an isp on the bread board like to clip the chip in and out ? that is a good idea
if there cheap ill get some for my pcb
in anther note i ran in to a problem using the arduino mega as the isp ... ?
i did every thing in the video as he did im thinking its a library issue ?
when i tried to load the blink sketch it came back as nothing was declared in the scope
error out put , pin mode ,high low ext...
beginning says arduino .h there is no such file in directory
im assuming i missing a attiny 85 library or some thing ?
ok problem solved need to run an older version of arduino compiler environment compiled on version 22 but after upload with error message that you suppose to get it still don't blink the led at this rate ill never get to debugging the code i wanna use hahaha..
new error message says
avrdude: please define pagel and bs2 signals in configuration
file for part attiny85
avrdude: stk500_program_enable (): protocol error, exect=0x14,
const int ledPin = 50;
const int threshold = 600;
int toggle = 40; // motor on / off
void setup()
{
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(toggle, OUTPUT);
Is that exactly what you're trying to compile?
const int ledPin = 50;
pinMode(ledPin, OUTPUT);
So, we're going to make pin 50 an output?
int toggle = 40; // motor on / off
pinMode(toggle, OUTPUT);
So, we're going to make pin 40 an output?
umm no that was what pins i was useing for the mega but yes i that is the code i would like to get on to the attiny 85 but using the pins avable need one pwm out put pin 2 analog read pins
so i can change those when i get to the point of uploading the code to the attiny im sue at the moment
im trying to compile the blink skectch to the upload to the 85 to make sure it works but soo far no luck in just geting the blink example to upload .. it compiles now with the older environment version but fails after an attempt to upload pins 10-12v recive no signal im not sure if they should or not but they dont after button to upload on compiler is hit only the rx and tx flicker on the mega few times for a burst of one second then it sits there doing nothing for about 45 seconds the fail messages is displayed
avrdude: please define pagel and bs2 signals in configuration
file for part attiny85
You'll always get that, you just look past it - irrelevant, nothing to see here.
avrdude: stk500_program_enable (): protocol error, exect=0x14,
initialization faild, rc=-1
Those are meaningful, but I'm not sure what of.