Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > how to interface sensors with psoc 5

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



how to interface sensors with psoc 5
Moderator:
ANCY

Post Reply
Follow this topic



how to interface sensors with psoc 5

subramanyam posted on 03 Feb 2013 10:07 AM PST
Senior Member
11 Forum Posts

 

i am doing project on data logger for MAV aircraft using psoc..i am learning psoc..how to interface sensors with psoc..especially tcs3722,mqu3 with psoc..can psoc takes 5 v??can i interface analog signals directly to psoc..




Re: how to interface sensors with psoc 5

danaaknight posted on 03 Feb 2013 01:10 PM PST
Top Contributor
1773 Forum Posts

It would help if you post the sensor datasheet links, or the datasheet itself.

 

Generally speaking PSOC can handle quite a few interfaces, see http://www.cypress.com/?id=1353

 

Additionally extensive analog capability, here for training http://www.cypress.com/?id=1353&rtID=134

 

and here for videos http://www.cypress.com/?id=1162&source=header

 

Datalogger excellent solution using PSOC, A/D, D/A, OpAmp, PGA, DAC, muxes, reference

 

If you list your goals, and sensors links you want to use, forum can take a look at them

and comment.

 

Regards, Dana.

 



Re: how to interface sensors with psoc 5

Gautam Das posted on 04 Feb 2013 10:44 PM PST
Cypress Employee
742 Forum Posts

Hi Subramanyam,

 

PSoC can be used to interface with the sensors which give out digital data using communication protocols such as I2C, SPI, etc.

Sensors which give out analog output can also be interfaced with PSoC by using the available analog blocks such as ADCs, PGA, Opamp, etc.

When used as a datalogger, PSoC can be used to store and continuously transmit the collected data to a larger system such as a PC via UART or USB.

As Dana has mentioned, please provide more info about the sensors you are intending to use.

 

Regards,

Gautam Das



Re: how to interface sensors with psoc 5

danaaknight posted on 04 Feb 2013 04:18 AM PST
Top Contributor
1773 Forum Posts

You can also use the emFile component to datalog to an SD Card.

Note there will be limitations on sampling rate in the system to do this,'

eg. SD Card rate.

 

Re: how to interface sensors with psoc 5

danaaknight posted on 04 Feb 2013 04:19 AM PST
Top Contributor
1773 Forum Posts

 

Re: how to interface sensors with psoc 5

rahulram posted on 04 Feb 2013 11:42 AM PST
Cypress Employee
112 Forum Posts

If you want any help on this, please do feel free to raise the case. We are ready to help you in building the whole design.

https://secure.cypress.com/myaccount/?id=25&techSupport=1&source=headers&CFID=1471097&CFTOKEN=81678209

Regards,

Rahul ram



Re: how to interface sensors with psoc 5

rahulram posted on 04 Feb 2013 11:48 AM PST
Cypress Employee
112 Forum Posts

Sorry that is an account specific link

 

Please Visit www.cypress.com

Support ---->Technical Support and create case.

 

You can create a case there and we will support you through the deisgn.

 

regards,

Rahul Ram



Re: how to interface sensors with psoc 5

subramanyam posted on 25 Mar 2013 01:45 AM PST
Senior Member
11 Forum Posts

thank u for all ur replies.

here are some of the sensor details which i'm using

flex sensor-www.sparkfun.com/datasheets/Sensors/Flex/flex22.pdf.

current sensor-acs714 -www.alldatasheet.com/datasheet-pdf/pdf/217298/.../ACS714.html

we have flex sensor with us now, it wud be heplfull if we get to know the interfacing of it with psoc.



Re: how to interface sensors with psoc 5

danaaknight posted on 25 Mar 2013 04:12 AM PST
Top Contributor
1773 Forum Posts

The current sensor interface straight forward, as its a Vout device, a simple interface to A/D.

 

The flex sensor, if you are operating it over very small flex ranges, consider using

it in bridge topology, and A/D in differential mode to eliminate CM issues. Larger

ranges plan on non linear compensation in code.

 

A general guide to bridge usage.- www.ti.com/lit/ml/slyp163/slyp163.pdf

 

Regards, Dana.



Re: how to interface sensors with psoc 5

hli posted on 25 Mar 2013 04:16 AM PST
Top Contributor
675 Forum Posts

AFAIK Sparkfun has only a ACS712 sensor, sont a CAS714. But both work the sam weay, so my explanations should not matter.

Both types have an analog signal output, so you will need an ADC to read their values. The ACS714 directly outputs a voltage corresponding to the current it is measuring, so you can connect it directly to the PSoC.

The Flex sensor changes its resistance, so you will need another resistor to form a voltage divider whose output you then feed into the PSoC. The second page of its data sheet shows this basic circuit. You can implement the OpAmp buffer shown there within the PSoC. This page also gives you the formula how the measured voltage corresponds to the resistance of the sensor.



Re: how to interface sensors with psoc 5

danaaknight posted on 25 Mar 2013 05:34 AM PST
Top Contributor
1773 Forum Posts

Since the tolerance of the flex sensor is so poor consider a cal

routine where a button is pushed while fex sensor flat, or some null

position. Then use that "offset" to correct reading. Note flex sensor

datasheet fairly poor in specs, no non-linearity specs shown. Or

temp effects.

 

Use of a simple R divider, like shown in datasheet, subject to CM issues,

so beware. Also no buffer is needed as A/D presents, relative to the sensor,

a very high Z input.

 

Regards, Dana.



Re: how to interface sensors with psoc 5

subramanyam posted on 25 Mar 2013 07:49 AM PST
Senior Member
11 Forum Posts

 i used acs714 current sensor..maximum output voltage of sensor is 8v.so i have to step down to 3.3v to interface with psoc.i used votlage divider along with buffer but it gave 2.08 v for 5 v input.i tried all methods but failed.can any body help me??

for flexi sensor i need to know the deflection versus resistance and i d'nt know how to test the sensor.it's new for me.



Re: how to interface sensors with psoc 5

danaaknight posted on 25 Mar 2013 08:11 AM PST
Top Contributor
1773 Forum Posts

Re. flex sensor, send manufacturer an email and ask for that data.

Beyond me why its not in datasheet.

 

As far as current sensor issue, post a project. Or set up a simple

test bed where you add a VDAC, set it to a voltage, and input that

to A/D. I suspect your conversion to volts from counts is at issue,

or the reference value you selected.

 

Regards, Dana.



Re: how to interface sensors with psoc 5

hli posted on 25 Mar 2013 01:07 PM PST
Top Contributor
675 Forum Posts

The ACS is, according to the data sheet, specified for a supply voltage of 5.0V. The 8.0V you mentioned are the absolute maximum it can withstand. Also, its sensitivity is, depending on the version. between 40mV/A (for the 50A version) and 185mV/A (for the 5A version). So the maximum output voltage you can get from it is 2.0V (for the 20A and 50A version, the others are less). So this sounds like the ADC gave you the right answer...



Re: how to interface sensors with psoc 5

danaaknight posted on 25 Mar 2013 02:45 PM PST
Top Contributor
1773 Forum Posts

Until we know the gain factor for the attenuator/divider used or the

current tested at can we conclude his 2V measurement is spot on.

 

@ subramanyam , so what are these factors in your design ?

 

Regards, Dana.



Re: how to interface sensors with psoc 5

subramanyam posted on 25 Mar 2013 09:27 PM PST
Senior Member
11 Forum Posts

output of current sensor is 5 v i need to convert to 3 v.i used voltage divider with 1.7k n 3.3 k resistors n used lm358 op amp but giving 2.08 v only i have to convert to 3 v atleast.does anybody have values of flexi sensor??i d'nt have pratical values of flexi sensor.i d'nt no how to test also.i have flexi sensor.



Re: how to interface sensors with psoc 5

hli posted on 26 Mar 2013 10:59 PM PST
Top Contributor
675 Forum Posts

As I said abovem the current sensor output goes up only to 2V. If you see more than 2V there, you are over-loading it.

How did you test your voltage divider? Where did the 5V you put on it come from? And did you verify, with a multimeter, that the output (which is what you are measuring with the ADC) is what you expect it to be?

How did you set up the ADC for measurement? If you used a 2.048V reference for it, you won't be able to measure higher voltage, since you always get the maximum result.

The value for the flex sensor are stated in the data sheet. But you can also measure them with a simple ohm meter.



Re: how to interface sensors with psoc 5

danaaknight posted on 26 Mar 2013 02:56 AM PST
Top Contributor
1773 Forum Posts

Start by asking/observing following -

 

1) You are running LM358 with Vcc of 5V  or 3V ? If 3V its output swings to Vcc - 1.5, 1.5 Voutmax.

Unloaded maybe a little more, basically 2 Vbe. So LM358 not appropirate for 3V operation, a RRIO

part would max dynamic range.

 

2) If running LM358 at 5V,. you have a series R from its output to PSOC to limit charge injection

current to spec ? Thats to handle power  for the case LM358 transients to 5V and sources lots

of current into PSOC input pin protection circuit. PSOC 5 limits Iprotectiondiode <= 100 uA.

 

3) The 2V you say you are measuring, it that at output of R divider ? Which means output of ACS714

reflects huge current, out of spec........

 

Regards, Dana.

 

Regards, Dana.



Re: how to interface sensors with psoc 5

hli posted on 26 Mar 2013 03:36 AM PST
Top Contributor
675 Forum Posts

Can you give us a schematic drawing how you connected the sensors to the PSoC board? Can you tell use which voltages you measured (with a multimeter) at which point of this circuit?

Also, can you upload your Creator project?



Re: how to interface sensors with psoc 5

subramanyam posted on 26 Mar 2013 04:48 AM PST
Senior Member
11 Forum Posts

 @hli i have attached block diagram.max voltage of current sensor is 8 v given in data sheet.i connected sensor to psoc through signal conditiong cicuit which is attenuator .i got 3.3 v using that.

i checked flex sensor resistance using multi meter but i need code for that and does it depend on angle??what's relation between angle and resistance

where will i get codes for current and flex sensor.i just need sample code atleast  so taht i can write my own code



Re: how to interface sensors with psoc 5

subramanyam posted on 26 Mar 2013 04:55 AM PST
Senior Member
11 Forum Posts

 @danna i used lm358 with 3.3 vcc.output of voltage divider is 3.3v and given to lm358.i used pull up resistor 20k  in vcc 3.3 so it's giving 3 v at the output.i shouldn't give 5 v vcc bcz psoc can take up to 3.3 v oly so op amp may go around 5 v



Re: how to interface sensors with psoc 5

subramanyam posted on 26 Mar 2013 05:12 AM PST
Senior Member
11 Forum Posts

 @danna i used lm358 with 3.3 vcc.output of voltage divider is 3.3v and given to lm358.i used pull up resistor 20k  in vcc 3.3 so it's giving 3 v at the output.i shouldn't give 5 v vcc bcz psoc can take up to 3.3 v oly so op amp may go around 5 v



Re: how to interface sensors with psoc 5

hli posted on 26 Mar 2013 05:27 AM PST
Top Contributor
675 Forum Posts

@subramanyam: why do you insist on using the current sensor outside of its specification? The data sheet clearly says its supply voltage is 5V - why do you want to power it with 8V?

And you never ever should get 3.3V on its output - this means that you are severely overloading the sensor! (Check the data sheet - the output should be at most 2V, for some types of the sensor it is even less than that).

Also - what did you set as reference voltage for the ADC?

I also cannot see a block diagram :( Can you please try to re-attach it? (and a real schematic would be better than just a block diagram - the devil might be in the details).



Re: how to interface sensors with psoc 5

hli posted on 26 Mar 2013 05:28 AM PST
Top Contributor
675 Forum Posts

For an example of how to use the flex sensor, see this tutorial from Sparkfun: https://www.sparkfun.com/tutorials/270 (It uses Arduino code, but the only thing you need to change is the reading of the ADC, which is quite straightforward with the PSoC).

Why do you want us to tell you about the relationship between bending of the sensor and its resistance? When you measured it with a multimeter, you already should have the values you need (resistance when not bend and resistance when bend 90 degrees. The formula of the voltage divider then gives you the voltage you will measure with the ADC.



Re: how to interface sensors with psoc 5

danaaknight posted on 26 Mar 2013 08:06 AM PST
Top Contributor
1773 Forum Posts

" @danna i used lm358 with 3.3 vcc.output of voltage divider is 3.3v and given to lm358.i used pull up resistor 20k  in vcc 3.3 so it's giving 3 v at the output.i shouldn't give 5 v vcc bcz psoc can take up to 3.3 v oly so op amp may go around 5 v"

 

The LM358, with a Vcc = 3.3, its output will essentially saturate at Vcc - 1.5 = 1.8. The fact you are getting 2V is

the output swing spec is with a small load, 2K if I remember correctly. So LM358 is not a good choice if you

run it off of 3.3. You can run it off 5V, you just have to make sure that if its output went to max it would drive <

100 uA into PSOC input pin. Using the pullup on output does not increase the linear operating range of the

LM358, even though Voh is higher. Thats because the final driver stage is a compound darlington and its base

was driven high long before your input got to 3.3.

 

Additonally LM358 CM input range is only Vcc - 1.5, in this case 1.8 V.

 

So in short run the LM358 at 5 V, add a series r on its output to PSOC pin to limit 100 uA injection

current problem, or get another OpAmp. And as hli points out, run the current sensor at 5V, in spec.

 

Regards, Dana.



Re: how to interface sensors with psoc 5

danaaknight posted on 26 Mar 2013 09:50 AM PST
Top Contributor
1773 Forum Posts

Ignoring the obvious, that is me, why do you even need the LM358 buffer ?

Use on chip OpAmp configed as a buffer, if you even need that ?

 

Regards, Dana.



Re: how to interface sensors with psoc 5

subramanyam posted on 27 Mar 2013 01:19 AM PST
Senior Member
11 Forum Posts

 @danna can i give directly sensor output to psoc??befor giving to psoc it should be 3.3 v otherwise psoc will gone.so i am using lm358 



Re: how to interface sensors with psoc 5

danaaknight posted on 27 Mar 2013 03:44 AM PST
Top Contributor
1773 Forum Posts

As hli pointed out, max output of your sensor is ~ 2V at its rated max current,

so yes interface to PSOC directly to A/D or to a buffer in PSOC OK.

 

Is your sensor toast ? Because you are getting >> 2V ?

 

Regards, Dana.



Re: how to interface sensors with psoc 5

subramanyam posted on 27 Mar 2013 07:19 AM PST
Senior Member
11 Forum Posts

 no it's not 2 v maximum is 8v i am uploading pdf file of acs714 have a look at it



Re: how to interface sensors with psoc 5

danaaknight posted on 27 Mar 2013 08:38 AM PST
Top Contributor
1773 Forum Posts

This part is a 5V part. It has a max rating of 8V, but all its performance specs are

characterized at 5V. As such you design this to run off a 5V regulated supply.

 

The specs show what the output will do, below is the 50A case, what the output voltage

will be and its offset due to the fact the part handles bidirectional current flow. So your use

of a divider, because you are running PSOC at 3.3, is appropriate. Furthermore with a 2:1

divider then you can feed divider out directly into PSOC A/D.

 

 

 



Re: how to interface sensors with psoc 5

subramanyam posted on 22 Apr 2013 10:51 PM PST
Senior Member
11 Forum Posts

instead of acs714 i am using wcs2750.i have attached data sheet of it.how to interface this with psoc??i have written the code already but problem with interfacing.is there any current sensor other than this??



Re: how to interface sensors with psoc 5

Bob Marlowe posted on 22 Apr 2013 11:40 PM PST
Top Contributor
1768 Forum Posts

Please avoid to double-post a question here, I started already to answer at http://www.cypress.com/?app=forum&id=2233&rID=78678 

 

Bob



Re: how to interface sensors with psoc 5

hli posted on 22 Apr 2013 12:47 AM PST
Top Contributor
675 Forum Posts

Also, don't hijack old threads with new, and possibly unrelated questions. Creating a new thread for new problems increases your chance that someone will look at them and help you.



Re: how to interface sensors with psoc 5

danaaknight posted on 22 Apr 2013 02:58 AM PST
Top Contributor
1773 Forum Posts

Answered on www.cypress.com/

 

Regards, Dana.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20