8
 1 Sarah Heim, homework for isotdaq 2010 4x4 Numerical Touchpad Design 1. Possible wire geometry (wires don't touch,when not pressed, metal plate underneath as ground):      1       2       3      5       6       7      9       10     11 12     13    14     15 A D C B        A B  C  D     0  0  0  0     0  0  0  1     0  0  1  0     0  0  1  1     0  1  0  0     0  1  0  1     0  1  1  0     0  1  1  1     1  0  0  0     1  0  0  1 10   1  0  1  0 11   1  0  1  1 12   1  1  0  0 13   1  1  0  1 14   1  1  1  0 15   1  1  1  1 => the code is simply the binary expression of the number on the pad!

0 1 2 3 8 9 10 11 12 13 14 15 - CERN · 2 Sarah Heim, homework for isotdaq 2010 4x4 Numerical Touchpad Design 2. Decoder (in python, simple, because we can make use of binaryinteger

Embed Size (px)

Citation preview

  1Sarah Heim, homework for isotdaq 2010

4x4 Numerical Touchpad Design

1. Possible wire geometry (wires don't touch,when not pressed, metal plate underneath as ground):

0      1       2       3

4      5       6       7

8      9       10     11

12     13    14     15 

A

DC

B

       A B  C  D0     0  0  0  01     0  0  0  12     0  0  1  03     0  0  1  14     0  1  0  05     0  1  0  16     0  1  1  07     0  1  1  18     1  0  0  09     1  0  0  110   1  0  1  011   1  0  1  112   1  1  0  013   1  1  0  114   1  1  1  015   1  1  1  1

=> the code is simply the binary expression of the number on the pad!

  2Sarah Heim, homework for isotdaq 2010

4x4 Numerical Touchpad Design

2. Decoder (in python, simple, because we can make use of binary­integer conversion):

from pico import *pico = ScratchBoard(0)pico.open()

while(True):    valueA = pico.getResistanceAValue()    valueB = pico.getResistanceBValue()    valueC = pico.getResistanceCValue()    valueD = pico.getResistanceDValue()

    if valueA < 99:        A = 1    else:        A = 0    if valueB < 99:        B = 1    else:        B = 0   

    if valueC < 99:        C = 1    else:        C = 0    if valueD < 99:        D = 1    else:        D = 0

    stringCombi = str(A)+str(B)+str(C)+str(D)

    print stringCombi    print "Sensorvalue: ", int(stringCombi, 2)         pico.close()

  3Sarah Heim, homework for isotdaq 2010

4x4 Numerical Touchpad Design

3. Consider merging touchpad with FSM:

­ use the numbers on the touchpad as code for different beverages­ each beverage has a different branch with a chain of finite states:it requests money, can give change, and finally gives the beverage(same as we did for the coffee example in lab 10)

­ it would be nice to reduce the number of states, and use the chain of payment states for all beverages (like in slide 5 of lab 10), but FSMs don't have memory, and you need a way to tell the machine in the end which beverage to pour.=> one idea would be to let the initial choice change a switch (which remains in this position), and then have some sort of an “AND” logic in the end to figure out which beverage was requested (the following is not an FS diagram, just a rough illustration of my idea):

Choice/touchpad

coffee

teaChain of requesting money, giving change

Switch to state coffee/teaPour coffee

Pour tea

  4Sarah Heim, homework for isotdaq 2010

Data Extractor

Task: Manually extract datapoints from a 2D plot.

Idea: 1. use sliding switch, attach wire (in order to get position of point more exactly)2. measure first x, then y coordinate of point (by sliding the switch, so that the wire is exactly on top of the desired point). For y coordinates, turn board and put it parallel to y axis3. do that for all points(indicate end of measurement by change resistance on port A from infinite to finite)

Example: positions of wire (x, y) to measure this point

  5Sarah Heim, homework for isotdaq 2010

Data Extractor

The code:

  6Sarah Heim,                                                           homework for isotdaq 2010

Data Extractor

To stop measurement

The “scanned” plot(done relatively sloppily, can be done much more nicely :)

 

The original

  7Sarah Heim, homework for isotdaq 2010

Data Extractor

Further thoughts, improvements:

­ To make the data extractor deal with more scientific data, one should scale the x and y axis according to the scales/units of the original plot.

­ Right now, the extractor works only for plots that are smaller/equal to the reach of the sliding switch; it would probably make far more sense, to either scale the slider, use it to select values that are read from the plot, or even use the touchpad and simply type in the x and y coordinates of the desired points.

=> using the slider for entering values only requires scaling and minor changes in the code (see code extract next page)

  8Sarah Heim, homework for isotdaq 2010

Data Extractor

Print values, so that one can select the right one and then press the button