1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Digital Fat Calliper Sensor

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by vivian_lys90, Jan 19, 2013.

  1. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,886
    Likes:
    500
    Location:
    Cleveland, OH, USA
    I think the sensor schematic can probably be figured out over the Internet. Your Post#32 will be very helpful.

    1) Post#1: Can you get a clear image of the same thing?
    2) Post#4, top image: Can you get a clear image of the same thing and an image with the lever moved about half way up the scale?
    3) Can you get a picture of the bottom of the moving contacts. That is, the part that slides against the mating areas on the PCB.

    With those clear images and maybe a few more diode/resistance measurements, a schematic can probably be figured out. I am assuming that on the moving part there are just two contacts.

    Finally, when you turn on the device (before you took it apart) did the pincers have to be closed, or could you turn it on with the pincers already partly open and have it still work properly?

    John
     
    • Like Like x 1
  2. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    John, the board is simply a pair of switch matrices separated using the diodes; see post #51 for schematic.

    It can be used in the same way as a standard switch matrix, except that attention has to be paid to whether a column or row is driven low as this will affect which matrix is read. See post #61 for code to read the matrix.

    @vivian: perhaps you can get some understanding of how scanning a switch matrix works from here: http://jingfenghanmax.blogspot.com.au/2010/09/3-x-4-keypad-matrix.html
    or http://www.dribin.org/dave/keyboard/one_html/ (don't worry about the selecting diodes section)
     
    • Like Like x 1
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,886
    Likes:
    500
    Location:
    Cleveland, OH, USA
    I saw post #51 and with due respect, I couldn't figure it out. I think I know what you intend from a high level, but not a single connection is shown.

    I am used to working with Eagle and that design (post #51) would not lead to creation of a meaningful board design. If you looked at my critical pathway chart, you should realize that I consider the actual switch design a bit of a diversion at this time. Nevertheless, I can appreciate Vivian's desire to get it resolved and see it as no big deal doing that with a little additional information. At the very least, it will allow for real results during simulation -- at least if she uses Assembly, which I don't think she will. I don't know how C simulators work.

    John
     
    • Like Like x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia

    If you didn't understand it, then I obviously need to work on my delivery. I tried to state that each intersection in the matrix shown in the drawing should have a switch; that is, every time a row wire crosses a column wire (in the diagram), it should be assumed that there is a switch there (between the row and column). I have seen switch matrices drawn in this manner on different occasions. The switch is 'turned on' when the wiper bridges the gap between the row and the column contacts on the PCB. I might redraw it some time.

    So then the pending step is to study the commercial device, then purchase a microcontroller, prototype board, programmer and temporary display.

    I strongly believe that studying a commercial device is very important.

    I think the next step should be defining the desired outcome of his/her project. This really is the most important step.
     
    • Like Like x 1
  6. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    Ok, here's the schematic for the switch matrix again. Hopefully it makes sense. PB0-1 may have connections reversed, though this can be corrected in the code very simply.
     

    Attached Files:

    • Like Like x 1
  7. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,886
    Likes:
    500
    Location:
    Cleveland, OH, USA
    I agree that is probably right based on available information in Vivian's post #32, now that you have fixed the diodes for the upper level and lower level ranges (e.g., the pair of diodes shown connected by the magenta line are segments 3, 7, not adjacent segments).

    A few additional tests by Vivian should confirm it. Since it is at least a double-sided board, I usually confirm electronically where I think connections go, even though they may appear to be connected a certain way.

    John
     
    • Like Like x 1
  8. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    Now I'm using Proteus ISIS 7 Professional software to draw and test my circuit design. Do you know how to draw the fat matrix using the Proteus?

    Thanks.

    Vivian
     
  9. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    Sorry, not sure what you're referring to.

    I haven't used Proteus in years, nor do I have a copy ATM. From what I remember it was very straight forward to use. If I were to simulate the matrix I would probably use two rotary switches to select the appropriate row and column together, or failing that, I'd use two sets if eight switches to do the same; beats placing 256 switches.
     
    • Like Like x 1
  10. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    View attachment PIC16F887.PDF

    Hi,

    This is the circuit that I draw, can anyone check is my circuit design is correct. For the fat matrix, I assume there consists a lot of push-up button, so when the slider is slide, and stop at one of the button, then the button will be pressed, and from there the thickness of the skin can be known.

    Thanks :eek:


    Vivian
     
  11. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    The resistors for the LEDs should be between the PIC outputs and the LEDs (not connected to Vcc).

    As mentioned prior, the LEDs and extra switches can be added to the matrix using an extra pin.

    You haven't connected your LCD.

    Otherwise, at a glance, it looks good.
     
    • Like Like x 1
  12. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    View attachment pic16f887 new.pdf

    Hi Doug,

    This is the editted circuit design. Is that the connection for LEDs is correct now? And the LCD connection, can you help me see is there got any problem. Thanks a lot!


    Vivian
     

    Attached Files:

    Last edited: Mar 28, 2013
  13. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    That looks better. Remember to connect the LCD VSS to GND
     
    • Like Like x 1
  14. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    Thanks for helping me. Now I have my circuit design already!:eek: But the big problem is the programming code, this is a very big problem for me. :(


    View attachment pic16f887 new.pdf
    This is the latest design of circuit, I connect the LCD Vss to GND, is it correct?

    Thanks.

    Vivian
     
  15. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    I have some question about the code for reading the caliper value,

    1.
    why need this?

    2.
    what is this for? Is it to clear the column?

    3.
    I not understand this.

    4.
    What is this for?

    5.
    what is this?


    Sorry for so many question, i'm trying to understand the code. Thanks.


    Vivian
     
  16. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi,

    I have a question. Can I replace the potentiometer which connected to the LCD with a resistor? Because the potentiometer is too big, I want to make my device small.


    Vivian
     
  17. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    1. why need this?
    This just allows a fast way to get a power of two value, because pow = 1 << i; (for i in 0..7)

    2. what is this for? Is it to clear the column?
    This is just to set the output value of pins on PE0-1 to 0. These pins are kept as inputs, except when one is driven low.

    3. I not understand this.
    It sets one of the PE0-1 pins as an output so that it can be driven low. The code should actually be: "TRISA = (TRISA & 0xF0) | (~pow2 & 0x0F);"

    4. What is this for?
    This sets one of the PB0-1 pins as an output so that it can be driven low. The code could be simplified to: "TRISB = ~pow2[j];"

    5. what is this?
    That is just checking if one of the PE0-1 pins have been pulled low.

    I have a question. Can I replace the potentiometer which connected to the LCD with a resistor? Because the potentiometer is too big, I want to make my device small.
    Depending on the display, you can sometimes just connect a resistor from the contrast pin to ground. You may need to place two resistors as a voltage divider, however.
     
    • Like Like x 1
  18. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    Can I know what programming software are you using for programming the fat matrix code? If I use MicroC to program my code, is it same as the fat matrix?
    Thanks

    vivian
     
  19. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,672
    Likes:
    215
    Location:
    Brisbane, Australia
    I used a notepad to write the code I posted. I think it can be compiled by any ANSI C compiler. You could use MicroC, but I believe the data types may be non-standard. Other options include HiTech PICC18, the Microchip C compiler, or SDCC.
     
    • Like Like x 1
  20. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    I have question about the fat matrix. So assume now the PEO-1 (4 input) want to scan the column of the scale, how is it functioning? And the function of the 8 diode which connected with the PEO-1. I know diode's function is only allowed current flow from one direction. But I still can't figure out what is the function of diode in this fat matrix.


    Vivian
     
  21. vivian_lys90

    vivian_lys90 New Member

    Joined:
    Nov 14, 2012
    Messages:
    75
    Likes:
    0
    Hi Doug,

    For the fat matrix programming code, I found that you stated there as 'enable weak pull-ups on port B' for the coding of nRBPU=0, but from the PIC16F887 manual, it state that :

    bit 7-0 WPUB<7:0>: Weak Pull-up Register bit
    1 = Pull-up enabled
    0 = Pull-up disabled

    So, is that means the coding should change to nBRPU=1 in order to enable the weak pull-up? And I try to use the microC to run the code, it shows that ' Undeclared identifier 'nRBPU' ' for the nRBPU=0.


    Vivian
     

Share This Page