Week11: input devices

Input devices:

This week’s assignment is centered around electronics input devices. "Input devices" include any kind of analog or digital sensor that can be interfaced with a microcontroller.

Different types of sensors:

A sensor is a hardware device that is able to measurement a physical properties (like temperature, pressure, magnetic field). The data that is generated / measured by a sensor is usually in analogue form.

We can distinguish 4 main categories: active vs passive sensor and digital vs analogical

  • Active sensors: require an external source of power (excitation voltage) that provides the majority of the output power of the signal.
  • Passive sensors: the output power is almost entirely provided by the measured signal without an excitation voltage.
  • Digital sensors: the signal produced or reflected by the sensor is binary.
  • Analogical sensors: the signal produced by the sensor is continuous and proportional to the measurand.
  • Below a list of sensors (not exhasutive):

  • Gas sensor measurin the levels of oxygen, carbon dioxide or others
  • Infra-red sensors to detect heat sources and motion
  • Light sensors to measure luminous intensity (in Candela)
  • Temperature sensors (in °Celsius)
  • Electric current (in Ampere)
  • Voltage in Volts
  • Capacitance in Farad
  • Force in Newton
  • Pressure in Pascal Pa
  • Acceleration in m/s
  • Moisture / Humidity sensors
  • Acoustic sensors
  • pH sensors
  • Magnetic field sensors
  • Group assignment:

    Probe an input device's analog levels and digital signals

    Individual assignment:

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

    For this individual assignment, we received the following rules from our tutor about what we can or cannot do / use this week to deliver the individual assignment:

  • Use of the ARDUINO UNO in the architceture of the solution: NO
  • Use of the XIAO-RP2040: YES
  • Sensors must be connected in a "clean way" to the PCB using headers to avoid flying electric wires !
  • For the assignment, I have decided to use a PIR sensor which work by detecting infrared light given off by a moving object or person that emits heat. This PIR sensor will be required in the architceture of my final project and therefore it's a good opportunity to start "playing" with this input device

    Overview of the PIR sensor:

    List of components integrated on the PCB:

  • 1 micro controller (Module_XIAO-RP2040)
  • 1 LED (that will be turned "On" when a presence is detected)
  • 1 resistor (R_Small US type) associated with the LED
  • 1 Conn_01x03_Pin (footprint: Connector_PinHeader_2.54 > PinHeader_1x03_P2.54mm_Vertical) to make a clean connection / integration of the PIR sensor onto the PCB
  • 2 TestPoint connectors (ootprint: TestPoint > TestPoint_Pad_4.0x4.0mm), one connected with the GND signal and one with the output PIN of the PID sensor.
  • Overview of the PCB schematic when done:

    Assignment of the footprints to the components

    After updating PCB from the schematics, manual move of the components to remove all tracks crosses and routing operations using the "route tracks" button, the results is as follows:

    Then I defined and created the edges of the PCB:

    At this stage, I ran a DRC check and no errors came out:

    3D view of the newly created PCB:

    PCB KiCad file archive download

    PCB for PIR KiCad project

    Export the KiCad project into .svg file(s). Selection of the F.Cu layer, File => export => SVG"

  • creation of one .svg file for the "traces"
  • creation of one .svg file for the "outline"
  • After that I have created an additional .svg file (the holes layer) using INKSCAPE:

    .svg files:

    Wires layer .svg file Holes layer .svg file Outline layer .svg file

    Transformation of the .SVG files into specifc .GCode format using online tool modsproject.org.

    Wires layer .rml file Holes layer .rml file Outline layer .rml file

    As soon as the 3 .rml files are ready (wires layer, holes layer, outline layer), time to use the Roland SRM-20 milling machine to create the PCB

    Overview of the PCB right after completion of the 3 steps milling ((wires layer, holes layer, outline layer)

    Note: as usal, one 1/64 inch diameter mill has been used to create the wires and one 1/32 inch diameter mill to create to mill the outline and the holes.

    Soldering of the electronic components on the PCB. It took less than 30 minutes (thanks for yhe learning curve )

    Module_XIAO-RP2040 mounted on the PCB:

    PIR sensor connected to the PCB: the Hardware is ready !

    Software programming phase:

    Using ARDUINO IDE, I have created a simple piece of code to be uploaded and executed on the XIAO-RP2040:

    This piece of code basically deals with:

  • Activation of the serial communication
  • Checking every 1 second of the status of the ouput of the sensor
  • if output is "0", "No presence detected" message sent through the serial comunication port
  • if output is "1", "presence detected" message sent through the serial comunication port
  • Overview of the code and execution on the serial monitor:

    After some testing iteration, we have evidence that the integration of this piece of code with the PIR PCB built works as expected.

    ARDUINO Sketch file