Product catagories of stylus pen for ipad, which is just for iPad Versions 2018 & 2019 and above.
It can work on following:
iPad 6th 2018: A1893/A1954
Stylus Pen For Ipad,Stylus Pen,Stylus Pen For Drawing,Touch Pencil Shenzhen Ruidian Technology CO., Ltd , https://www.wisonens.com
As shown below:
Circuit diagram after distortion after optocoupler
Waveform after distortion after optocoupler
Ok, the above is the question, now we begin to discuss and teach you to analyze ideas.
The first step: look at the PC817B data sheet to see if the frequency PWM frequency is exceeded.
The second step: As shown in the above waveform diagram, at 20K, the voltage gain is significantly reduced in the frequency response diagram, so you can also verify it and try to reduce the frequency.
The third step: 20khz wants to be basically undistorted, you can change the 1M optocoupler.
Step 4: Please pay attention to the minimum value of the current transfer coefficient CTR. You can calculate the current input Iin and the maximum current Iout = Iin * CTR. According to the above calculation, your circuit can't drive 12V/800 ohm circuit. You can change R14 to 200 ohms, then try again.
Actual debugging effect:
Replace R14 with over 300 ohms, and there is basically no output signal at 300 ohms.
Reduce the frequency to 2k, basically no distortion, it seems that the frequency is too high.
Peripheral discourse:
Everyone continues to discuss, give people who pass by more ideas, good technology and good advice.
iPad 7th 2019: A2197/A2198/A2200
iPad 8th 2020: A2270/A2428/A2429/A2430
iPad air 3rd: A2152/A2153/A2154/A2123
iPad Air 4th: A2072/A2316/A2324/2325
iPad mini 5th: A2124/A2125/A2126/A2133
iPad Pro 1st/2nd 11: A1980/A2013/A1934/A1979/A2228/A2068/A2230/A2231
iPad Pro 3rd/4th 12.9: A2069/A2229/A2233/A2232/A1876/A2014/A1895/A1983
Ok, now let's talk about the distortion of the pwm waveform through the pc817b optocoupler.
6N137 is about 1.8 yuan
4N25 also costs about 1 yuan
PC817 only needs about 1.5 hair.
Think about it, a penny of goods, PC817 as long as 1 hair 5, no distortion is strange.