Assignment 10

Input Devices



The last week we were asked to gain knowledge about input devices. Of course, an input device can be easy as a button but the assignment is more about getting to know devices like sensors, that are used as input devices.

I decided to use get to know a photoresistor, which is able to detect if there is light or not. I also want to use this sensor for my final project, so gaining knowledge about it in this weeks assignment is handy as well. For the output device I chose to use a LED, that will turn on/off according to how much light the photoresistor captures.

The input week's group assignment was: measure the analog levels and digital signals in an input device. For the output week we were asked to measure the power consumption of an output device. You can find the documentation for both on the Group project page.

Schematic and Board

I designed a very basic board using Eagle again. As I have described how to design a schematic, a board and milling the designed board in detail in Assignment 4 I will just present some photos from this process for my light sensor board.

Light sensor board schematic.

Light sensor board after wiring.

Light sensor board after milling was finished.


Soldering

After milling I soldered all the components to my board. The following components were part of it:
1. 1 x Attiny 44
2 . 1 x Photeresistor
3. 1 x 10mikroF SMD Capacitor
4. 2 x 10kΩ SMD Resistor
5. 1 x 220Ω SMD Resistor
6. 1 x red SMD LED
7. 2 x 3 Pinheader
8. 1 x 4 Pinheader
9. 1 x 2 Pinheader

All components and the milled board.


Programming

To program my self made board I used the Arduino IDE. I.e. I used the Arduino as an ISP to program my input/output board.

Important steps:

  • Before the Arduino can be used as an ISP, make sure that you flash the program 'File/Examples/11.ArduinoISP/ArduinoISP' onto your Arduino first. Simply connect the Arduino to your USB port and flash the program.
  • A second step before you can start programming your board you have to do 'Tools/Burn Bootloader'. While burning the bootloader you need to connect your Arduino to your own board in a special way. The connection can bee seen in the left picture underneath. Of course always make sure when using the Arduino as ISP that you put in the correct values for the board, processor and clock (as seen in the right picture underneath).
  • Left: Connection of Arduino and board (drawn my Paulina Reijsmeijer). / Right: Burn Bootloader option.


    If the burning of the bootloader worked you will receive this message from the Arduino IDE as seen in this picture. I had the problem that first the bootloader did not run properly. After flashing the Arduino twice again with the 'ArduinoISP' example it finally worked.



    Code
    I connected my sensor with an output device and i.e. the code of my input device is combined with the code of my Output Device assignment. You can find the description of it in the section 'Photoresistor and LED' and the code is attached at the end of the page as well.


    How the Microcontroller Datasheets & Pinouts helped
  • The datasheet of the Attiny 44 was helpful in terms of finding out which pin of the microcontroller are MOSI, MISO etc. This was of course very important during drawing the schematic of the board to design the ISP header (Atmel datasheet Attiny44/24).
  • The pinout provided for the Arduino Attiny communication was valuable during the programming with the Arduino IDE. I could find out what is the name of my input and output pin on my attiny 44 board on the Arduino. I know that these pinouts were presumably created by someone in the Arduino community and not official but they are still very helpful.
  • Attiny44 pinout and according Arduino pins.

    Attached files:

    Light Sensor Schematic
    Light Sensor Board