User Tools

Site Tools


jansonntag:attempt3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
jansonntag:attempt3 [2021/02/07 11:06]
jan
jansonntag:attempt3 [2021/03/13 13:57]
jan
Line 1: Line 1:
-====== Analog Cherry Keyboard Attempt 3 (WIP) ======+====== Analog Cherry Keyboard Attempt 3 ======
  
 After a while of looking at it, this seems far too complicated! There have to be simpler, cheaper, and more accurate solutions. I started searching for some ICs that maybe can do the trick but didn't found any good other than the links I posted above. But then Henrik found something great: The LDC1314 After a while of looking at it, this seems far too complicated! There have to be simpler, cheaper, and more accurate solutions. I started searching for some ICs that maybe can do the trick but didn't found any good other than the links I posted above. But then Henrik found something great: The LDC1314
Line 18: Line 18:
  
 I found even more detailed pictures on the website of the "mother-company" of knops: https://alltrons.com/analog-keyboard-technology/ I found even more detailed pictures on the website of the "mother-company" of knops: https://alltrons.com/analog-keyboard-technology/
- +They are only mentioning copyright for 2018 and 2019. The company seems to be very inactive.
-{{https://www.mememaker.net/api/bucket?path=static/img/memes/full/2017/Jun/4/4/im-about-to-destroy-this-mans-whole-career.jpg}}They are only mentioning copyright for 2018 and 2019. The company seems to be very inactive.+
  
 Now with a 5V to 3.3V converter with ultra-low noise output. With all these bypass capacitors this has to be a super-duper ultra-low noise circuit.  Now with a 5V to 3.3V converter with ultra-low noise output. With all these bypass capacitors this has to be a super-duper ultra-low noise circuit. 
Line 47: Line 46:
  
 So I need a 33.3kOhm resistor in front of the LTC6900 Set-Pin. So I need a 33.3kOhm resistor in front of the LTC6900 Set-Pin.
 +<WRAP center round tip 60%>
 +This (the LTC stuff above) will get "important" later, so you should read this article till the end.
 +</WRAP>
 +
  
 And here is my first "final" schematic then:\\  And here is my first "final" schematic then:\\ 
Line 114: Line 117:
 Let's go through this code step by step: Let's go through this code step by step:
   - Import the library and the Wire library (I2C)   - Import the library and the Wire library (I2C)
-  - Then instantiate an LDC131X Object (the false means now alternative address)+  - Then instantiate an LDC131X Object (the false means no alternative address)
   - The lastTen and pointer variables are needed later to calculate an average of 10 measurements   - The lastTen and pointer variables are needed later to calculate an average of 10 measurements
   - The setup starts with initiating the Wire and Serial communication   - The setup starts with initiating the Wire and Serial communication
Line 130: Line 133:
       - fREF0 = 43 Mhz       - fREF0 = 43 Mhz
       - fSENSOR0 = 5960,977 kHz ~ 6 Mhz (See the Webench screenshot)       - fSENSOR0 = 5960,977 kHz ~ 6 Mhz (See the Webench screenshot)
-      - {{https://www4b.wolframalpha.com/Calculate/MSP/MSP46401i4e44h1bb41h46600004a4935287fa011bd?MSPStoreType=image/gif&s=20&.png?|}}+      - {{:projects:settlecount0-math.gif?200|}}
       - 8.9563 + Margin = 15       - 8.9563 + Margin = 15
     - ldc1314.LDC_setClockDividers(0, 0x1002)     - ldc1314.LDC_setClockDividers(0, 0x1002)
Line 141: Line 144:
         - 40Mhz > 4 x 6Mhz -> reference Divider can be set to 1         - 40Mhz > 4 x 6Mhz -> reference Divider can be set to 1
       - these two combine to 0x1002       - these two combine to 0x1002
-      - look up page 21 of the documentation two see the register map for CLOCK_DIVIDERS0+      - lookup page 21 of the documentation two see the register map for CLOCK_DIVIDERS0 
 +    - ldc1314.LDC_setErrorConfig(0x0000) 
 +      - ERROR_CONFIG 
 +      - default 
 +    - ldc1314.LDC_setDriveCurrent(0, 0xE800) 
 +      - DRIVE_CURRENT0 
 +      - I got the IDRIVE0 value from the table on page 40 of the documentation 
 +      - The best-fitting values (Nominal Sensor Current (μA), Minimum Sensor RP (kΩ), Maximum Sensor RP (kΩ)) where IDRIVEx Register Field Value 29 (b11101) 
 +      - INIT_DRIVE0 got set to 0 
 +      - combined 1110100000000000 -> 0xE800 
 +    - ldc1314.LDC_setMUXConfig(0x20D) 
 +      - MUX_CONFIG 
 +      - 0x20D -> 0000001000001101 
 +      - Auto-Scan Mode Enable -> 0 -> Continuous conversion on the single channel selected (0) (just testing with channel 0 right now) 
 +      - Auto-Scan Sequence Configuration -> 00 -> Ch0 + Ch1 
 +      - Input Deglitch Filter Bandwidth -> 101 -> 10 MHz (ƒSENSOR = 6 MHz) 
 +    - ldc1314.LDC_setGain(3) 
 +      - RESET_DEV 
 +      - 3 -> 16x gain -> 4 bits shift 
 +      - MOST IMPORTANT OPTION together with OFFSET. More about that later. 
 +    - ldc1314.LDC_setOffset(0, 0x4FFF) 
 +      - OFFSET0 
 +      - 0x4FFF -> 100111111111111 (I know it's very high but that's needed) 
 +    - ldc1314.LDC_setConfig(0x0801) 
 +      - CONFIG 
 +      - 0x0801 -> 0000100000000001 
 +      - Active Channel Selection -> 00 -> Perform continuous conversions on Channel 0 
 +      - Sleep Mode Enable -> 0 -> Device is active (This is important to set after configuring everything. Otherwise the device will stay in sleep mode.) 
 +      - Sensor RP Override Enable -> 0 -> Override off 
 +      - Sensor Activation Mode Selection -> 1 -> Low Power Activation Mode (made no difference for me right now) 
 +      - Automatic Sensor Amplitude Correction Disable -> 0 -> Automatic Amplitude correction enabled 
 +      - Select Reference Frequency Source -> 0 -> internal oscillator (More about this later) 
 +      - INTB Disable -> 0 
 +      - High Current Sensor Drive -> 0 -> 1.5mA max per Channel 
 +  - After configuring all the settings the LDC is now active 
 +  - In the loop, I just read out the value of coil 0 (key D) and store the value in an array 
 +  - If I have ten readouts I calculate the average and print it on Serial 
 + 
 +As I found out through trial and error, because of the fact that the coils are so tiny and the spring inside the switch isn't huge either, I needed a high gain and a high offset. An easy way to describe this is like using a magnifier and looking at a specific part of the value. But if you want to find out more about this topic, this document here really helped me: [[https://www.ti.com/lit/an/snoa945/snoa945.pdf?ts=1612720736953&ref_url=https%253A%252F%252Fwww.google.com%252F|Optimizing L Measurement Resolution for the LDC1312 and LDC1314]]. Especially the pages 6 and 8 contain graphics that are really helpful. The whole document isn't that long and worth a read. 
 + 
 +As you may have seen I set the LDC to not use the external oscillator I put on the PCB. This is because I miss understood the reason for this pin to exist. It´s an alternative to the internal oscillator. I thought I would have to put in the value I calculated for ƒSENSOR in Webench. That's why I have a 6Mhz input now. This is not needed! The LDC will compare the oscillating frequency that comes back from the coil (this is the 6MHz I calculated) with the internal oscillator (40 MHz) or a given external oscillator. But the oscillating frequency should be greater than 4 x 6MHz. Because this isn't the case with the one I got, I´m just using the internal one. This works so the external one does not have to be populated on the PCB. This also saves in cost on the final PCB. I hope this was understandable. 
 + 
 +Here you can see both the board and the plotter in action (recorded separately):\\ 
 +{{:projects:20210208_113429.gif|}}{{:projects:com8_2021-02-08_11-28-45_trim.gif|}} 
 + 
 +As you may see the graph shows when the button is pressed and how far it is pressed. But the result is not very accurate and there is a lot of interference. This is because of the high gain I set. But otherwise, there wouldn't be a graph at all. The 12-bit resolution of the LDC1314 is just not accurate enough for this combination of coil and precision needed. 
 + 
 +So there will be an attempt 4. There I will test out the bigger brother of the LDC1314: The LDC1614. It has the same pinout and overall package, so it will be an in-place replacement. The big advantage is the 28-bit resolution. Hopefully, there is no gain needed then. 
 + 
 +\\ 
 +[[JanSonntag:attempt4|Attempt 4 (Coming soon)]]\\ 
jansonntag/attempt3.txt · Last modified: 2021/03/24 17:10 by jan