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 !!
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.
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
Keep in mind on Creator start page there is a link to find example
projects, there are several for ADC both SAR and DelSig.
I did look the example, but I didn't quite get it.
I got following sensor, which I can read voltage using multimeter.
so, how could I connect my output voltage of sensor to ADC and what code should I use it read value ?
Another question is how could I read PWM signal ?
What do you want to read about the PWM ?
2) Duty cycle
3) Values programmed into it for period and duty cycle ?
The basic way you read a voltage -
1) Choose A/D, DelSig for hi resolution measurments, SAR for fast sample rate
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 ?
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.
@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.
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 !!!
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.
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.
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?
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.
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??
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.
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.
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.
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.
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.