Week 9 - Input devices

Week 9 - Input devices

2018, Oct 31    

Notes

  • pyroelectric: detect motion
  • sonar: detect distance (but need to bounce back to the receiver)
  • optical sensor to measure distance (emerging recently, very impressive)
  • TCC: datasheet, the frequency of the time (/1, /2, /4, /8…)
  • ADC: datasheet
  • resample to reduce noise (error decreased to: 1/sqrt(n_sample))
  • magnet sensor
  • temperature sensor (bridge to magnify the change of the resistor)
  • IR sensor (light sensor)
  • IMPORTANT: syncronous detection (actively on & off and detect the difference)
  • accerlerameter (designed to reflow) translation/rotationary
  • Microphone (can read the waves)
  • Step response (must try, very interesting)
  • piezo (vibration)
  • force sensor (is not accurate)
  • vision: linux board (Recommended), WebRTC pixcam, OpenMV, OpenCV

Preparation

Prior year’s documentations is helpful:

  • Read NTC thermistor in Arduino & ATmega328 link

  • Useful pin illustration: link

Questions

How to read analog voltage?

Recall previous knowledge:

DDRxn (eg. DDRA1): set PA1 to input(0)/output(1)

PINxn (eg. PINA1): read digital input of the PA1, low(0), high(1)

PORTxn (eg. PORTA1): write digital output of PA1, low(0), high(1)

New knowledge

Related registor: In the ATtiny 45 datasheet Chapter 17.13 there are the description of the registers:

ADMUX

How to find the NTC thermistor in the EAGLE?

Clue: Nicolo said the fab library doesn’t have the Hall effect sensor, but the general EGALE library have the A1302.

Guess: The NTC thermistor has the similar/same size of the regular fab resistor, therefore Neil’s board has the same pads for them.

The relationship between temperature and resistor?

There’s formula in Neil’s python code:

   # NHQ103B375R5
   # R25 10000 (O)
   # B (25/85) 3750 (K)
   # R(T(C)) = R(25)*exp(B*(1/(T(C)+273.15)-(1/(25+273.15))))
   B = 3750.0
   R25 =  10000.0
   T = 1.0/(log(R/R25)/B+(1/(25.0+273.15))) - 273.15

The type of our NTC is NHQ103B375R5, the datasheet is here, There’re two parameters: R25 Ohm and B 25/85K. How to use them?

According to the wiki of the NTC (Negative Temperature Coefficient) thermistor, there are 3 ways to estimate the temperature from resistor, we are using the beta parameter equation.

\begin{equation} R(T)=R(T_0)\cdot e^{\beta(\frac{1}{T}-\frac{1}{T0})} \end{equation}

And here, the $T_0$ is 25K, and according to the datasheet, R(25K) = 10000 Ohm, $\beta$ = 3750.

MIT Fab lab Inventory

The inventory includes the required items to establish a fab lab. Here’s the link.

Why we need a default R1(10k) and Capacity(1uF) for the micro-controller

What is SCK in the AVRISP, and what’s RX, TX, RTS, CTS in FTDI?

Here’s AVRISP datasheet link.

scheme

Open question: Bridge’s influence?

Neil introduced the bridge in the class. It’s used to find appropriate range for the thermistor. I’m wondering what if we don’t use bridge, just use one 10K resistor and NTC thermistor, but write in the C code to do the same operation (i.e. (V-2.5)*20.0), will we loose accuracy?

One possible answer is: there are some measurement in the analog comparator. So when the range is more appropriate the error will be reduce.

Process

Thanks to Elliot and Vivian’s help, I learned how to use the other mill.

some useful notes:

  • Othermill can read the .brd / Gerber file

The board comes out very well, and I programmed it with Neil’s code. And it works! Yay!

Problems remained

The max temparature in the python code is 29.82?

By printing the parameters, this is because the output value is -512~511. When the value is 511, the max temparature is 29.82. I think by setting ADC registor MUX from 20(PB4-PB3) to (PB4-PB3), it will have larger range.

###

Learned knowledge

  • There is 0.1 nm knife for the ATmega chips. Because their pins are really close.

  • The step response touch pad is using RC (Resistor Capacitor) circuit. The circuit have a capacitor and a touch pad in parallel from output pin to ground. and an input pin connected with the resistor to read the value. Human usually have large capacity and is connected with the ground. So the input will change when human touch the pad. And it send step response, so that we can discriminate the original capacitor from the ambient capacitor.


Acceleration

I also want to measure the acceleration. The component is difficult to solder, but is a good opportunity to learn reflow technique. Also the accelerometer can give a rough position estimation which could be useful for the GelSight sensor’s position.

After some search, I find there may be a lot of challenge to use the acclerometer: there’s no ADXL343 library and it’s very hard to solder. So I will try this at last if have time.


Photo-transistor

  • Prior student’s page

Design

Problem

What’s the relationship between light and resistor?

What’s the minimal time for ADC to read?

Clue link said Atmel recommends a max ADC clock of 1MHz for the ATMEGA8. And free-run mode takes 13 ADC clocks to read (on almost all AVR parts).

What’s the speed of FTDI to serial?

Notes

  • the orientation of the photo-transistor is in the datasheet. The color side is “Collector” and the white side is “Transmitter”. And the based on the NPN structure, the positive side is Collector (green one)

Speed up?

I tested to decrease the delay for serial communication. The 1 ms will be enough for sending one charactor.

And Also I tried to speed up the ADC clock. The pre-scale is 1/128, then I changes to 1/16, and it also works faster.

Now the frequency is about 10x higher.