张小哥

The most beggar 17-key + touch strip mechanical keyboard

 
Overview

After consulting Qinheng engineers, I learned that the CH551G has been discontinued, and the CH552G that is still in production is fully compatible with the program. You can consider this when buying chips.

By the way, someone bought the CH551G without a USB boot program and reported to me that it could not be burned. Here I will directly post a link to the one I bought before that worked.

I will not vouch for the store. In Huaqiangbei Electronic City, if a store does not have this chip, it will ship the order to the stall next door. I don’t know if the chip that cannot be programmed will be sold out.

Kit sales link: http://aliurl.cn/299o2p

Function description:

light:

  • When in lock: 1Hz breathing
  • When not locked: 0.5Hz breathing

button:

  • Due to the limited number of IOs, the keys conflict and simultaneous presses cannot be recognized, but there is no conflict locally (2, 4, 5, 6, 8)
  • When it is not num lock: the minus sign key code will be replaced by backspace to facilitate accounting entry.

touch:

  • The touch strip has a 90Hz sampling rate
  • Automatic zeroing algorithm at startup to avoid capacitance differences between washed and unwashed plates
  • When the touch bar is in num lock: slide the volume adjustment, click in the middle to play/pause, press up and down to switch music
  • When it is not num lock: slide to become the mouse wheel, click in the middle to open the calculator, press up and down to adjust the brightness [valid for notebooks or all-in-one computers]
  • Please see the attached video for specific touch operations.

other:

  • Onboard STC programming port, UART and buttons are multiplexed, with automatic power-on function (multiplexed with LED driver mos tube), but the program is not adapted yet.
  • The USB port is drawn out at a 45° angle to the upper right, with a unified design language from the previous generation.
  • It adopts micro usb interface and consumes redundant micro cables. DIYers who want type C can modify it by themselves.

cost:

  • PCB sizes are all within 10*10cm
  • The electronic components are simplified, except for the microcontroller, buttons and LEDs, there are only 1 field effect transistor, 2 resistors, 3 capacitors and 4 diodes.
  • Capacitive touch buttons are free because they are integrated on the PCB~~~ (~ ̄▽ ̄)~

principle:

Capacitive button position detection principle:

Example of capacitive button principle.png

Although the technical document does not provide the internal circuit, I guess the principle is similar to the above. The size of the touch capacitance is detected by counting the resistance-capacitance oscillation output pulses.

Moreover, the capacitance change of the touch capacitor is proportional to the contact area, so the middle position of the press can be obtained through simple proportional calculations.

In order to enlarge the intermediate transition position, the touching copper will be made like a staggered comb, as shown in the picture below.

touch pad.png

PS: The same principle applies to capacitive touch screens and trackpads.

For detailed recommended shapes for touch copper pouring, see the attached PDF.

Capacitive button debounce procedure:

uint touch_data[5];//读取回来的原始数据,正常工作时范围在4000~1000
uchar touch_leve[5];//滤波后的数据,保留百位数
void hysteresis()//滤除噪声
{
  uchar i;
  uint temp;
  for(i=0;i<5;i++)
  {
    temp=touch_leve[i]*100;
    if(touch_data[i]>temp+100)//每次才加减这一点点,动态是差点,但在90Hz采样率下这都不是什么大问题
      touch_leve[i]++;
    else if(touch_data[i]<temp-100)
      touch_leve[i]--;
  }
}

The program filtering algorithm is similar to a hysteresis comparator. It enters the next level only when it reaches a specific threshold. After entering the next level, the upper and lower trigger thresholds will also change.

In other words, it's just Schmidt's trembling.

This thing is very similar to the capacitor plate detection paper quantity that was very popular before. Interested students are recommended to check it out. I will not reinvent the wheel.

If you want the program, click on my avatar to see the <CH551G Touch DEMO> project.

Matrix key scanning principle:

Matrix structure.jpeg

This is the original circuit modified from the previous work. If you haven’t seen it, click on my profile picture to see past projects.

Note that this picture shows positive logic, and 51 is a weak pull-up output, so in actual use it is negative logic (reverse the diode).

As can be seen from the picture, in addition to the matrix buttons, there is also a row of independent buttons below, which are completely reused, but the button conflict is serious.

Except for independent buttons that can be pressed at the same time, only one of the other buttons can be pressed at a time, otherwise it will not be possible to tell which buttons are pressed.

Of course, you can add money to achieve full-key collision-free. But in the end, I still have to compromise with the cost.

If you are a little wealthy and bridge a bunch of 74HC595, the possibilities are endless, right `( >﹏< )′

PS: There is a low-end version of 595 in LCSC, which is only 1 cent each when it is not out of stock. Now it is 2 cents.

Appreciation of physical disassembly: (Why disassembly? Because the shooting and production process was missed)

The left is the main board and the right is the base plate. Just like the previous one, we use M3 nuts to connect them. The screws do not protrude from the base plate and are not afraid of scratching the fabric.

Note that the screws are inserted under the positioning plate first and then the shaft body is welded to fix the positioning plate.

IMG_20210206_140026.jpg

The bottom plate pattern can be changed at will, but it has no function anyway.

IMG_20210206_140107.jpg

The USB port on the bottom panel is slotted to make the keyboard thinner.

IMG_20210206_140349.jpg

Take a photo with the current main keyboard

IMG_20210206_140418.jpg

cover

IMG_20210205_155941.jpg

Operation video: https://b23.tv/f7rfO5

The video uploaded in the attachment does not look smooth, so I posted it to site B.

software

Burning tutorial: https://oshwhub.com/TheLight/zi-ding-yi-jian-pan

Capture.PNG

Program update log:

What was added previously is not recorded in detail. It is still undergoing functional iteration.

Ver0.4:

  1. Added capacitive buttons to self-calibrate when powered on. Please ensure that the touch area is clean when powered on.
  2. Touch area function modification
    • When in num lock: slide the volume adjustment, click in the middle to play/pause, press up and down to switch music
    • When it is not num lock: slide to become the mouse wheel, click in the middle to open the calculator, press up and down to adjust the brightness [valid for notebooks or all-in-one computers]

Ver0.41:

  1. Enable watchdog
  2. Fix the BUG of crash after USB bus reset

Ver0.42:

  1. The brightness change process is modified from linear change to logarithmic curve.

Ver0.421: (Customized branch)

  1. Modify the lighting effects, remove the calculator function and change it to brightness control

Ver0.43:

  1. Fix touch conversion bug (not verified, theoretically more sensitive)

Thanks for citation

Principle description picture reference link: https://baijiahao.baidu.com/s?id=1621173179116478690&wfr=spider&for=pc #

PDF source: Shiqiang Components, Microchip, STMicroelectronics

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-18 11:10:32

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号