Input Devices (WEEK THIRTEEN: April 29)

 

What is input

Inputs and outputs in electronic circuits. The input is what sets an electrical circuit in action. Any of the following components can be used as inputs: a switch (eg push-switch, microswitch) ... a proximity switch or reed switch.

Assigment

measure something: add a sensor to a microcontroller board that you have designed and read it.

What I did

This week, i will choose a board from the list found in the fablab week 13 archive. I have chosen the magnetic field board because i want to try something new and useful at the same time. This board will discover the magnetic field in any area i put it in and checks if there are any magnetic waves or not.

This is found in fablab Archive/Schedule/InputDevices.
Click Here

The board will contain six components only shown in the above image.


This device is used for detecting objects wither they are exist or at an absent condition. It uses a sensor to detect magentic fields of these objects and read the radiations of the magnets. They operate using a certain voltage of powerup the sensor to be able to sence the radiations of the magnetic fields of any object.


The Eagle Schematic

This is the schematic plan of the PCB after connecting all the parts together.

The board has been drawn manually to due to the direction of the routes. Some of them goes under the components which create difficulties for the milling machine to draw it. So i tried my best to make them avoid going under the components.

This is the PCB board, and it is ready to be programmed.




Plugged in all the wires within the PCB to the laptop. Now it is time to bring a piece of magnet and check the magnetic field. Check the demonstration video below:-


The programming


In my cicuit board, I have connected the sensor with pin number PB3. The below program is the reading the input sensor's value (Serial Monitoring). I innitialized serial communication with 9600 bit/second. Instead of the loop, analog pin PB3. And I game the sensor value in between read one second.

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(PB3);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}

Download Files


Download Schematic File
Download Board File

Magnetic PCB Demonstration