No capactive sensing (CPS) module in FC 5

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

No capactive sensing (CPS) module in FC 5

Post by DirkB »

Hello,

is there any Chance to activate the "CAPACITIVE SENSING (CPS) MODULE"
in Flowcode 5? I am using PIC12F1840 and PIC 16F1825.

thanks

Dirk

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by Enamul »

I think you can use that in FCv5..But as a component no chance I guess. As MM now going ahead for FCv6
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
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

Post by Benj »

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.

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by DirkB »

Hello Benj,

do you have a complete example or a modified A/D Component only for PIC16F825?

Dirk

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by DirkB »

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

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by Enamul »

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.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
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

Post by Benj »

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.

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by DirkB »

cooool, thanks!

Dirk

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Dirk and all :D

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

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by Enamul »

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
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by Enamul »

Don't worry Jorgen, I will post code in FC for you before Christmas.
Enamul
University of Nottingham
enamul4mm@gmail.com

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by DirkB »

Hmm, it's not a one wire sensor. A sensor with timer2 OSC and normal ADC i have running.

Dirk

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Ok Dirk, sorry, I have misunderstand something :( And to you Enamul, really look forward to see. :D

Best regard

Jorgen

User avatar
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

Post by Benj »

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.
Attachments
CapTouch.fcf
(25.42 KiB) Downloaded 447 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Ben! :D

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

User avatar
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

Post by Benj »

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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Ben! :D :D

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.

User avatar
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

Post by Benj »

Hi Jorgen,

Is this the kind of thing you were after?
CapTouch.jpg
CapTouch.jpg (13.71 KiB) Viewed 21219 times
The ground plane is on the bottom copper and the cap touch pads are on the top copper.

User avatar
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

Post by Benj »

Here is a picture of the prototype E-block.
CapTouch_Eblock.jpg
CapTouch_Eblock.jpg (81.9 KiB) Viewed 21218 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Ben! :D

Yes, exactly, wery nice, thank you. I test it later, and I promise you hear from me.

Have a nice day.

Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

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.
Attachments
CapTouch_JGU.fcf
(21.71 KiB) Downloaded 342 times

User avatar
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

Post by Benj »

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.
CapTouch_JGU.fcf
(22.26 KiB) Downloaded 427 times
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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Ben!

Thank you for your help. I test it this evening and yoy hear. :D

Best regard

Jorgen.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: No capactive sensing (CPS) module in FC 5

Post by jgu1 »

Hi Ben! :D

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. :D 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.

User avatar
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

Post by Benj »

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.
CapTouch_pressure.fcf
(25.44 KiB) Downloaded 463 times

Post Reply