Week 10 - Input Programming
This week, we were introduced into input devices and sensors. Add a sensor to a microcontroller board that we have designed and read it.
Hello light board with a LED
I designed a PCB with Eagle with a light sensor. I added a LED. I wanted the LED to switch on or switch off according to the light received by my sensor.
There are the components we need:
- Capacitor : 1uF
- Resistor : 49.9K Ohm
- Resistor : 10K Ohm
- Resistor : 499 Ohm
- Resistor : Ok Ohm (bridge)
- ATTINY 45-SSU
- PinHD-2x2-SMD
- FTDI-S ( 1X06SMD)
-AVRISPSMD (AVRISP)
- LED. Blue clear (The negative pole will be oriented to ground)
Resistor : 49.9K Ohm: I dind't find this resistor in my inventary so I must to improvise. I join two 100k resistors and get the same resistor.
designing
For me, using Eagle is quite complicated and at times unintuitive. I have designed “hello light board” and I want to add a LED. To do this I made the same as in the electronic design assignment.
This micro only has 8 pins, the pin 8 is VCC and the pin 4 is GND. The rest can be configured as input devices.
Datasheet says that the pin1 is the RESET (PB5), the pin 6 is MISO and 5 MOSI. I can use the PB3 with the phototransistor because it is a ADC3, that means that it is an analog to digital converter as the led with the PB1 because I can convert the pin as an output (OC0B)
I connect the LED to PB1
Ok! It's milling and welding time!
It was my best welding time, I think, I know it's not the best one, but I'm proud.
Programming. Issues
First of all I connected my FabISP via USB to my lapop, the Hello Light via FTDI cable to another USB and then a communication cable between them.
PROBLEMS
I found some issues trying to program the board.
I have tried to do it in Arduino.
The first problem was that it could not make the burn to helloboard. I don’t know what’s wrong.
I was watching other boards and saw that there were several errors in the connections. I have missed much since I designed the board I did it based on another. Eagle told me where to join tracks that seem to be not quite correct.
I decided to cut the connection of the LED, connect the track with a cable and see what was happening.
Nothing happens. I looked closer and saw another light board in which the problem was the connections. With Another cable I corrected the error, and it worked!
It`s like a Frankenstein board.
Now I can program with Arduino. I use an already made routine and I modified it .
To find out which pins are Rx or Tx you should look at the ATtiny45 in Eagle. I thought they were 3 and 7 (its wrong)
Why is it wrong?
One need look no loose numbers, but the interiors. I must to connect to PB2 and PB4. If I do not connect properly the sensor will give me wrong information like this in the serial monitor:
Now I connect the right PB's.
I use the serial plotter to view a graph. The graph says the amount of light that the photoresistor receive. The data is 0 to 1023 because it will map input voltages between 0 and 5 volts into integer values between 0 and 1023, More info. The graph indicates that reads more (1023)or less light(0).
INPUT DEVICES |
|
Described your design and fabrication process using words/images/screenshots. |
X |
Explained the programming process/es you used and how the microcontroller datasheet helped you. |
X |
Explained problems and how you fixed them |
X |
Included original design files and code |
X |
FILES:
eagle hellolight scheme + eagle hellolight board
outcut traces + interior traces