No capactive sensing (CPS) module in FC 5
Moderator: Benj
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: No capactive sensing (CPS) module in FC 5
I think you can use that in FCv5..But as a component no chance I guess. As MM now going ahead for FCv6
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hello Dirk,
You can do cap touch sensing using just the Flowcode ADC component. We have plans for hardware that works using this approach.
http://www.microchip.com/stellent/idcpl ... e=en545264
For specific cap touch modules we may support some or all later down the road but due to the number of different cap touch peripherals available in chips and therefore the amount of work this would probably be a v6 only thing.
You can do cap touch sensing using just the Flowcode ADC component. We have plans for hardware that works using this approach.
http://www.microchip.com/stellent/idcpl ... e=en545264
For specific cap touch modules we may support some or all later down the road but due to the number of different cap touch peripherals available in chips and therefore the amount of work this would probably be a v6 only thing.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: No capactive sensing (CPS) module in FC 5
Hello Benj,
is it possible to realize one wire sensor like this with PIC and FC5 like this:
http://elm-chan.org/works/capsens/report_e.html
Dirk
is it possible to realize one wire sensor like this with PIC and FC5 like this:
http://elm-chan.org/works/capsens/report_e.html
Dirk
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: No capactive sensing (CPS) module in FC 5
That's quite interesting..Should be possible to implement easily in FCv5. I have had a request from Jorgan earlier to implement that but can't test because of PCB board. If I could manage to make one like shown in the video I can easily test the idea. I will try and let you know.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
I have a prototype E-block to do this on order. As soon as it arrives I will give it a go.
In the mean time one of the new MIcrochip applications boards I have has these so I might get around to having a quick go with this.
In the mean time one of the new MIcrochip applications boards I have has these so I might get around to having a quick go with this.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Dirk and all
Try looking here: http://www.pcbheaven.com/circuitpages/P ... ch_Button/
Maybe there is something that can be used. You can certainly get the hex file and put it in a pic. I've tried and it works.
I know I have asked before, but there is no one who can translate the code for FC. Admitted I don´t understand it 100% it could be funny to be able and make it in FC and maybe add more functions.
Best regard
Jorgen

Try looking here: http://www.pcbheaven.com/circuitpages/P ... ch_Button/
Maybe there is something that can be used. You can certainly get the hex file and put it in a pic. I've tried and it works.
I know I have asked before, but there is no one who can translate the code for FC. Admitted I don´t understand it 100% it could be funny to be able and make it in FC and maybe add more functions.
Best regard
Jorgen
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: No capactive sensing (CPS) module in FC 5
That's really nice one. I have gone through the theory video. That's really great. I really liked the idea of using ADC to sense the capacitance and ultimately sense the touch. Thanks a lot.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: No capactive sensing (CPS) module in FC 5
Don't worry Jorgen, I will post code in FC for you before Christmas.
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Ok Dirk, sorry, I have misunderstand something
And to you Enamul, really look forward to see.
Best regard
Jorgen


Best regard
Jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hello,
Here is a working example for software based cap touch.
Here is have 5 cap touch pads connected to AN0 - AN4.
AN5 (RE0) is connected to pin RE1 via a 1K resistor, RE1 is then set as a output and set to output the value 1. This is needed to charge up the internal ADC sample capacitor before switching the analogue input source and performing the sample.
The ADC_RAW_Configure_Channel command resets the ADC connection to AN5 (the connection specified by the ADC component ).
The C code then changes the ADC channel to the correct cap touch input channel before starting the ADC sample.
The code is running very reliably on my hardware, much more stable then I was hoping for.
Here is a working example for software based cap touch.
Here is have 5 cap touch pads connected to AN0 - AN4.
AN5 (RE0) is connected to pin RE1 via a 1K resistor, RE1 is then set as a output and set to output the value 1. This is needed to charge up the internal ADC sample capacitor before switching the analogue input source and performing the sample.
The ADC_RAW_Configure_Channel command resets the ADC connection to AN5 (the connection specified by the ADC component ).
The C code then changes the ADC channel to the correct cap touch input channel before starting the ADC sample.
The code is running very reliably on my hardware, much more stable then I was hoping for.
- Attachments
-
- CapTouch.fcf
- (25.42 KiB) Downloaded 599 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Thanks, I really look forward to test this. I asume that the GLCD is extra, and the output for each channel is from A0 to A5.
Best regard and you hear from me.
Jorgen

Thanks, I really look forward to test this. I asume that the GLCD is extra, and the output for each channel is from A0 to A5.
Best regard and you hear from me.
Jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hello,
I'm using a 16F1939 device which uses the following adc pins.
AN0 - A0 - Cap Touch Input 0
AN1 - A1 - Cap Touch Input 1
AN2 - A2 - Cap Touch Input 2
AN3 - A3 - Cap Touch Input 3
AN4 - A5 - Cap Touch Input 4
AN5 - E0 - Cap Touch VCC Reference and initial connection setting for the ADC component.
Digital Output 1 - E1 - VCC reference pin - you could instead connect the 1K resistor between E0 and VCC so as to not throw away two I/O pins.
The gLCD is extra and i'm just using this an a nice way to display the results. An alphanumeric LCD or set of LEDs could be used instead.
I'm using a 16F1939 device which uses the following adc pins.
AN0 - A0 - Cap Touch Input 0
AN1 - A1 - Cap Touch Input 1
AN2 - A2 - Cap Touch Input 2
AN3 - A3 - Cap Touch Input 3
AN4 - A5 - Cap Touch Input 4
AN5 - E0 - Cap Touch VCC Reference and initial connection setting for the ADC component.
Digital Output 1 - E1 - VCC reference pin - you could instead connect the 1K resistor between E0 and VCC so as to not throw away two I/O pins.
The gLCD is extra and i'm just using this an a nice way to display the results. An alphanumeric LCD or set of LEDs could be used instead.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Thanks for the explanation. But Ben is it too much to ask you to make make a small sheet of drawing for only capasitets relations.
Thank in Advance
Jorgen.


Thanks for the explanation. But Ben is it too much to ask you to make make a small sheet of drawing for only capasitets relations.
Thank in Advance
Jorgen.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hi Jorgen,
Is this the kind of thing you were after?
The ground plane is on the bottom copper and the cap touch pads are on the top copper.
Is this the kind of thing you were after?
The ground plane is on the bottom copper and the cap touch pads are on the top copper.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Here is a picture of the prototype E-block.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Yes, exactly, wery nice, thank you. I test it later, and I promise you hear from me.
Have a nice day.
Jorgen

Yes, exactly, wery nice, thank you. I test it later, and I promise you hear from me.
Have a nice day.
Jorgen
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Now I had a little time for test. I have change the program a litlle. Instead of using 16f1939 I change to 16f1937, they are wery semilar. With your permision I removed the GLCD, but Where should I add digital output Ex:
when I touh Cap A0 Out C0 On and off when not touch A0 And the same for the rest of the touch.
Thank´s in ADV.
Jorgen.
Now I had a little time for test. I have change the program a litlle. Instead of using 16f1939 I change to 16f1937, they are wery semilar. With your permision I removed the GLCD, but Where should I add digital output Ex:
when I touh Cap A0 Out C0 On and off when not touch A0 And the same for the rest of the touch.

Thank´s in ADV.
Jorgen.
- Attachments
-
- CapTouch_JGU.fcf
- (21.71 KiB) Downloaded 423 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hello Jorgen,
Here is a slightly modified version of your program which should allow you to control the state of pins C0 - C2 using cap touch on AN0 - AN2.
If your program is not working on the hardware then you may want to see what values the cap touch is giving you so you can tweak the current threshold value of 80.
To do this go into the Sample_Cap_Touch macro and disable the decision icon right at the bottom of the macro.
Then the value that is returned by the macro will be 0-255 instead of 0-1 so you can then print this to a LCD to determine what threshold value is correct for your hardware and clock speed etc. It might also be worth playing around with the ADC component conversion speed if your getting poor results.
Here is a slightly modified version of your program which should allow you to control the state of pins C0 - C2 using cap touch on AN0 - AN2.
If your program is not working on the hardware then you may want to see what values the cap touch is giving you so you can tweak the current threshold value of 80.
To do this go into the Sample_Cap_Touch macro and disable the decision icon right at the bottom of the macro.
Then the value that is returned by the macro will be 0-255 instead of 0-1 so you can then print this to a LCD to determine what threshold value is correct for your hardware and clock speed etc. It might also be worth playing around with the ADC component conversion speed if your getting poor results.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Thank you for your help. I test it this evening and yoy hear.
Best regard
Jorgen.
Thank you for your help. I test it this evening and yoy hear.

Best regard
Jorgen.
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: No capactive sensing (CPS) module in FC 5
Hi Ben!
Perfect, it´s working, wery nice and stable. I can se that it´s necessary to adjust, depending on the hardware. And on this way as you describe it´s possible to adjust the sensitivity to a certain limit.
So now I will play around with it. Maybe more touchbuttom and togglefunction ect. I think its a wery funny funktion.
Thank´s Ben.
Jorgen.

Perfect, it´s working, wery nice and stable. I can se that it´s necessary to adjust, depending on the hardware. And on this way as you describe it´s possible to adjust the sensitivity to a certain limit.

Thank´s Ben.
Jorgen.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No capactive sensing (CPS) module in FC 5
Hello,
Yes the mechanism works really well, you can configure the threshold from a very light touch all the way through to a heavy press so it is very flexible. It should be possible allow the macro to return if the switch is pressed and also how hard. Maybe return 0 for anything above the threshold value but anything under we simply subtract the reading from the threshold to give a increasing value as the touch pressure increases. Here is a quick demo. Pressure ranges from 0 for no touch to 1 for a valid touch and then up to about 15 for a hard press on my hardware though could be extended a bit because the no press value is more like 96 then 80.
Yes the mechanism works really well, you can configure the threshold from a very light touch all the way through to a heavy press so it is very flexible. It should be possible allow the macro to return if the switch is pressed and also how hard. Maybe return 0 for anything above the threshold value but anything under we simply subtract the reading from the threshold to give a increasing value as the touch pressure increases. Here is a quick demo. Pressure ranges from 0 for no touch to 1 for a valid touch and then up to about 15 for a hard press on my hardware though could be extended a bit because the no press value is more like 96 then 80.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel