Input Devices




Assignments
  • Measure something: add a sensor to a microcontroller board that you have designed and read it. (Individual Project)
  • Measure the analog levels and digital signals in an input device.



Summary of the week

I tried to make a Magnetic Field input sensor.I use an ATtiny45 microprocessor.




Designing and Drawing a Main Board and Sensor Boards of Magnetic Field


Eagle Schematics

I used Autodesk Eagle 8.7.1 to draw the Schematic and Board Layout.

Create the A1324 Device

Create the symbol of A1324


Create the package of A1324


Create the device of A1324


Draw the schematic

Design the eagle board


Arrange the line


Output the img in png format

Traces


Interior


Something to Consider

We have to name the png file and rml file in English, othervise the Milling Machine can't recognise them.

After assembling the PCB,use multimeter to check if all connections are good, don't rush to programm.




Programm the board



    #include "SoftwareSerial.h"

    const int analogInPin =  A2;  // Analog input pin that the potentiometer is attached to
    int sensorValue = 0;        // value read from the pot
    int outputValue = 0;        // value output to the PWM (analog out)

    const int Rx = 1; // this is physical pin 7
    const int Tx = 2; // this is physical pin 6
    SoftwareSerial mySerial(Rx, Tx);

    void setup() {
    //  pinMode(3, OUTPUT);
      pinMode(Rx, INPUT);
      pinMode(Tx, OUTPUT);
      mySerial.begin(9600); // send serial data at 9600 bits/sec
    }

    void loop() {
      // read the analog in value:
      sensorValue = analogRead(analogInPin);
      // map it to the range of the analog out:
      outputValue = map(sensorValue, 0, 1023, 0, 255);
      mySerial.println(outputValue);
      delay(100);

    }
  	




Files


Here are the files of my Magnetic Field Board.