10 -

Input devices

The goal of this assignment is measure something: add a sensor to a microcontroller board that you've designed and read it. I started from design circuit in Eagle.

input

eagle 2

my input device board:

input devices

Current Status:

1. I've made a board with Attiny45, but when i connected it to Arduino to burn bootlader, I found out i need an LED for showing board status.

2. I followed my note in week 7 embeded programming. but I still can not burning bootloader to attiny45.

Debug

What I did:

1. Did I make any mistake when I design my board? Yes, I have to connect ATtiny45's reset pin to AVRISP's reset pin.

2. Burn bootloader again. Done.

3. Coding in Arduino IDE:

#include <SoftwareSerial.h>
#define rxPin 0
#define txPin 1
const int analogInPin = A3;
int sensorValue = 0;
int outputValue = 0;
SoftwareSerial serial(rxPin, txPin);

void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
serial.begin(57600);

}
void loop() {
sensorValue = analogRead(analogInPin);
outputValue = sensorValue;
serial.print("sensor = " );
serial.println(sensorValue);
delay(100);
}

4. Connect potentiometer (mine is 1K) to analog input 3 (analog input tutorial on Arduino website).

Demonstration

Source Files:

borad trace: week_10_input_02 / week_10_input_02

programming: week_10_InputDevices

 

:)