Week 11

Input Devices
(Apr 13)

Assignment:

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

Design a board, add a sensor and read it

  • Note from lecture
    - beware of bit timing
    - pyroelectric measures changes of temperature. thermal radiation from your body. activity detector
    - sonar : ultrasonic transducers is just a pair of microphone and a loud speaker 
    designed to run above audio frequencies
    it only work if you get a reflection. e.g. if you tilt a surface it doesnt work. 
    the procesor has timer and counter. trigger and wait for echo.
    how far you can see depends on how good is the reflector
    - magnetic field : mostly used for proximity to magnet field. there's a sign so. 
    at the finest resolution you can measure earth's magnetic field meaning it can be used 
    also for orientation. produces analog output. convert analog-digital
    - web interface : node.js, a web page can not talk directly to usb ports cos security issues. 
    we use web socket, local server 	
    local server : javascript program talks to node. node is javascripts in a browser 
    but running out of the browser
    npm is packages for node. there's npm serialport 
    - temperature :2 standard kind : NTC and RTD
    NTC : goes to lower temp, more sensitive
    RTD : goes to higher temp, less sensitive
    both of them are not linear. neeed calibration.. fix resistor / variable resistor ??? 
    use a bridge to measure small changs, small signal
    - framing ? low byte / high byte ??
    - light : phototransistor : bipolar transistor 
    - Bit banging is a technique for serial 
    communications using software instead of dedicated hardware. 
    Software directly sets and samples the state of pins on the microcontroller, and is responsible 
    for all parameters of the signal: timing, levels, synchronization, etc.
    - I2C / SPI protocol...
    - identify objects : sample from MOMA : vinyl-cut rasonator.
    Each object has a vinyl-cut coil with a capacitor, 
    each ring has different freqency. the resonate frequency of the ringing way of distinguish objects
    
    			

1. Designing with Eagle

My plan is to modify Satshakit.
- capacitive as input
- powered by external battery
- send capacitive parameters via RF transmitter to another board (which will be explained more in networking exercise)

Here I started out with Satshakit Eagle file for laser and slowly added components and eliminate unneccessary connections.

Board view

I tried auto-routing but the result is not so convincing

So I moved manually components trying to organize best the board and here's a first satisfying result.

2. Modify a Package in Eagle

But I can not find a precise library for the powersocket so I tried to modify from an existing one.

Getting all the dimensions

Go to Control panel window > File > New > New Library and there will be a new library window open

back to Control Panel, right-click on a similar component and select Copy to Library

In our new Library, right-click on desired component, select Edit Package

And here I can modify it using "i" tool

Some more small modifications and here's the board

Adding text and cutting line with Inkscape

3. Laser and soldering

the settings

The board

Soldered

4. Programming

After soldered, I must try to make it blinks first !

The code is pretty simple : If Capacitive value is above threshold, turn on the LED

#include <CapacitiveSensor.h>

CapacitiveSensor capSensor = CapacitiveSensor (4, 2);
int threshold = 1000;

void setup()
{
  pinMode (13, OUTPUT);
}

void loop()
{
  int capValue = capSensor.capacitiveSensor(30); // capacitive sensor
  if (capValue > threshold) {
    digitalWrite(13, HIGH);

  } else {
    digitalWrite(13, LOW);
  }
  delay (100);
}

It works !


Download files :
Eagle files (zip)
Eagle exported image(png)
Inkscape file for laser(svg)
Inkscape exported image for laser(png)

<< previous | next >>