cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

 Hi there,

   

 

   

I got sensor from which analogue voltage is keep coming, so how could I read it using Psoc . What pins and code should I used ?

   

Any help would be great !!

0 Likes
26 Replies
Bob_Marlowe
Expert II

Welcome in the forum!

   

Analog signals can be used and routed to analog components within a PSoC5, To "read" an analog signal is not implemented, but you may use one of the analog-to-digital converters (ADCs) to convert the analog signal level into a digital value with up to 20 bit resolution.Look in Creator at the examples using any of the ADCs.

   

 

   

Have you got a PSoC5LP development kit? A CY8CKIT-050? Did you already install the Creator 3.1 software to design with PSoCs?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Thanks for your reply..I will have a look. Yes, I did got a Psoc creator software, but I am using following chip to program it.

   

http://www.powerfulboard.com/ 

   

I think it should work with it.

0 Likes
ETRO_SSN583
Esteemed Contributor

Some usful ap notes -

   

 

   

    

   

          

   

http://www.cypress.com/?rID=39157&source=an61290     AN54181 - Getting Started with PSoC 3

   

http://www.cypress.com/?rID=39677     AN57821 - PSoC® 3, PSoC 4, and PSoC 5LP Mixed Signal Circuit Board Layout Considerations

   

http://www.cypress.com/?rID=40247     AN58827 - PSoC® 3 and PSoC 5LP Internal Analog Routing Considerations

   

http://www.cypress.com/?rID=39974     AN58304 - PSoC® 3 and PSoC 5LP – Pin Selection for Analog Designs

   

    

   

 

   

          

   

http://video.cypress.com/video-library/video/Corporate/PSoC-5LP-Analog-Design/2167823360001

   

 

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Expert II

Yes, that will work. You will be going to program and debug your board using Creator.

   

 

   

Bob

0 Likes
ETRO_SSN583
Esteemed Contributor

Keep in mind on Creator start page there is a link to find example

   

projects, there are several for ADC both SAR and DelSig.

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi there,

   

 

   

I did look the example, but I didn't quite get it.

   

I got following sensor, which I can read voltage using multimeter.

   

http://www.maxbotix.com/articles/016.htm

   

so, how could I connect my output voltage of sensor to ADC and what code should I use it read value ?

   

 

   

Thanks

0 Likes
Anonymous
Not applicable

Another question is how could I read PWM signal ? 

0 Likes
ETRO_SSN583
Esteemed Contributor

Another question is how could I read PWM signal ?

   

 

   

What do you want to read about the PWM ?

   

 

   

1) Frequency

   

2) Duty cycle

   

3) Values programmed into it for period and duty cycle ?

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

The basic way you read a voltage -

   

 

   

1) Choose A/D, DelSig for hi resolution measurments, SAR for fast sample rate

   

measurments.

   

2) Configure its range, reference, channels, single ended.

   

3) Place a pin on schematic.

   

4) Connect the pin to A/D inputand set it as HiZ analog input.

   

5) Use APIs in datasheet to start it, read it.

   

 

   

What is it about the sample project(s) you do not understand ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 I know these steps, but If you could help me for schematics connection for it then it will be good for both PWM input and analogue voltage input.

   

I would like to read duty cycle of the input PWM signal.

0 Likes
JeCo_264681
Contributor

@AKB  I suggest that you look at the Example Projects. When you are PSoC Creator, go to the Examples and Kits >> Find Code Example .. and look for an example of what you need. Download the project and build it. This is your learning experience.  I'm thinking you are new to PSoC. Also, look on the Cypress website for tutorial videos. If I am wrong and underestimate your experience, I apologize. But I hope, if you are a beginner to PSoC, these tips are helpful.

0 Likes
ETRO_SSN583
Esteemed Contributor

To measure frequency and duty cycle / pulse width -

   

 

   

www.dropbox.com/sh/prpc74bdga7yijz/AAAeC-Dmmn5sYbWwRrl0-ZUoa

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

There are short videos here that will show you how to place components

   

and do basic projects.

   

 

   

    

   

          

   

http://www.cypress.com/?id=1162&source=home_support     Video Training

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi Dana, 

   

 

   

Thanks for your reply, I would able to measure width of the pulse by using a project you provided and integrated with my project.

   

 

   

Now I have question - Is there any way that I can take snapshot of the 10-15 pulse and stop system for some time and from those 10-15 pulses I would like to find median width of the pulse , in order to take action in my system. 

   

 

   

If you could help me for this then it will be great !!!

0 Likes
ETRO_SSN583
Esteemed Contributor

The way period and freq is measured means every other pulse is

   

not measured. So you could not do it for sequential pulses. But

   

you can collect 15 measured values and average them, it just

   

will not be sequential. The code is simple, just take each measure-

   

ment, place its value in an array, then when you have collected 15

   

do the sum and then average.

   

 

   

If you need sequential then a verilog solution would be in order.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hey there Bob,

   

I just finished a project that calculates Vrms using an ADC. Its a simple project. I use an Amux two switch between two analog signals. They work correctly when connected to a variable resistor. As i change resistance the voltage changes correctly. However my intention was for the signal to be drawn through the air. In other words I wanted to use a wire for antenna as an input. Then maybe it would detect a changing magnetic field. For example, the AC coming from a power outlet. I have seen videos of EMF detectors for Arduino but they are just no help. I'm not even sure if they used an ADC. How could I modify my project so that it could detect waves in air.

   

Thanks,

   

Sam

0 Likes
Bob_Marlowe
Expert II

What exactly do you want to perform? "Waves in the air" sounds a bit esoteric, magnetism is something more like physics. Did you already read about the CapSense components? Will that help you?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Originally I wanted the analog pin to detect radio waves. Not literal music but just signal at high frequency. So that as I get closer to the signal the analog input is strengthened. Sort of like the arduino EmF detectors.

0 Likes
Bob_Marlowe
Expert II

Not quite easy to separate the power line noise (in the range of 100V) from the RF (a some mV). You will need something like a filter and an RF amplifier. This will be difficult to find in a PSoC. What is the upper frequency you want to detect? 2.4 GHz??

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I am trying to detect frequency at 20KHZ. I want the device to read the intensity as I get closer to the source. I want a device that follows the intensity. The only issue is I cannot get stable values for analog.

0 Likes
JeCo_264681
Contributor

Consider two solutions: 1:  Build an analog band pass filter for 20KHz as your analog input. Could be passive components of LRC (Inductor(s), Resistor(s), Capacitor(s)
2: Add a FIR filter to your project and configure it as a band pass filter for 20KHz. If you want to know "intensity" which means energy, you are going to need a FFT analysis. That is a whole new discussion beyond the scope of this post. When you get that far, start a new discussion.

0 Likes
Bob_Marlowe
Expert II

You will not get stable values. An alternating signal is not stable. As I told, the most noise will come from power line. Separating the 20kHz frequency, amplify and rectify with a diode needs some external components.

   

 

   

Bob

0 Likes
odissey1
Honored Contributor II
        I am just curious what is the source of 20khz AC in the power lines?   
0 Likes
Bob_Marlowe
Expert II

Using an input pin as antenna will pick up power line noise. The 20kHz signal is not in the power line, but is a separate signal as I understand.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

hello how can i read a voltage and save it to a txt file or something else

0 Likes
Bob_Marlowe
Expert II

Welcome in the forum.

   

Get a CY8CKIT-059 prototyping kit. Use Creator 4.0 as IDE. Place an analog pin and an ADC and a UART onto your topdesign and wire them accordingly. With a few lines of code you convert the voltage at the pin and send the result to PuTTY via the internal bridge of the Kitprog.

   

Have a look at the example projects provided for every component you use.

   

 

   

Bob

0 Likes