Input Devices
———-
Group assignment:
- Probe an input device(s)’s analog and digital signals
- Document your work (in a group or individually)
Individual assignment:
- Measure something: add a sensor to a microcontroller board that you have designed and read it.
for this week assignment we have been asked to go deeper into electronic, specifically this week we will focus on input devices, and we should test it on a board that we designed, so as start i will make a new board to work with this week and i will planned a head so i can use it also for Output device
Designing New Board
as i have already explained the process in more details in electronic Design Week i will not put full details here again , just i will add the main steps
I will use ATtiny45 on this assignment
- to Design my board i used Kicad open source software.
Add component
- ATtiny45
- ISPSMD header
- capacitor
- led
- 2 * Resistor
- FTDI header
- 4 * 2 pin header
- 3 pin male header
connect them to Attinu45s
check the connection with design rule
after Checked the design rule i found there were no problem in the connection
Annotate schematic symbol
Assign foot print
in this step you can see the foot print for each component and make sure that you have choose the correct one
Generate Netlist
load netlist in PCB layout
from the pcb layout top bar click load netlist, then choose the one you saved in the past steps.
Adjust Trace Thinkness and Clearance
next is to adjust the setup from file –» board setting — »> Net classes
connect Traces to components foot-print
this seams to be one of the tsaks that east most of the time, every time i design a new board i take most of the time finding the best way to route the traces, i had to delete the FTDI header since i will use ISP programmer , and deleted the LEDs i will use it outside the board.
after that i ended up with this design
fill it with copper to connect the grounds
export the deign
now export it as svg ,
generate a tool-path
i used mods To generate the tool psth for the desing in order to prepare it to cut it with Roland- SRM20
Mill it with SRM-20
after that send the file to the printer to start milling it , you can refer to my assignment electronic production for more information about the exact steps to cut the machine
Milling Result
- now its time to solder
Soldering Result
lets run the programmer i will use Arduino as ISP
connect isp with arduino
- Connect pin 13 from Arduino = pin 7 in Attiny 45 = SCK ISP
- Connect pin 12 from Arduino = pin 6 in Attiny 45 = MISO ISP
- Connect pin 11 from Arduino = pin 5 in Attiny 45 = MOSI ISP
- Connect pin 10 from Arduino = pin 1 in Attiny 45 = RESET ISP
- Connect pin 5v from Arduino = pin 8 in Attiny 45 = VCC ISP
- Connect pin GND from Arduino = pin 4 in Attiny 45 = GND ISP
first example Blink
if you dont know how to upload the program follow my steps that i have explained in Embedded Programming upload the first example
Push button
one of the most important input devices is the push button, its important that you know how its connected and how to make use of it
the push button we are using have internal connection pin 1 -3 connected also 2,4 make sure to have it tested before going further, you can do that by simply connecting one side to 5v and the other side to led, you can also do the test with multimeter, but since the bread board is front of me i found this way is faster
input pull down
i have added 10K resistor going to the ground to make sure that the reading is sooth
input button to enable led
the program is simple , if the button is pressed , turn on an LED otherwise keep it off
you can download the code from here
LDR
LDR It stands for Light Dependent Resistor or Photoresistor, which is a passive electronic component, basically a resistor which has a resistance that varies depending of the light intensity.
to connect it with our board we need to connect one leg to input and wit 5k resistor pullup , the other side to ground as shwing here
with same function of the least program we can read analog signal, if the reading is more than specific value turn on an LED other wise keep it off.
but first lets connect it with Arduino to see the value that i will depends on, i will use ready example in Arduino , " analog read serial "
depending of this Value i can say that if the value is less then 200 its mean dark , and if its more its mean there is alight, so will write my program this way, and upload it to my board
you can download the code from here
push button serial
next i wanted to test the serial communication to read the value of my sensors in arduino serial monitor,
i found that serial function will not work directly, so i hade to use software serial and here is the result