Hello guys, I am a newbie when it comes to PSoC. I want to interface an ADXL335 accelerometer with PSoC3(CY8CKIT-030). Can anyone suggest me how to do so?
Since the ADXL335 has analog outputs for X, Y and Z you wikk need an analog multiplexor and an ADC to digitize the incoming signals. Have a look at the ADC-example project that is offered when you create a new project or select the example by right clicking on the ADC component.
Although obsolete this kit had a code base interfacing an accelerometer -
Juts go to the page for docs and ISO disk download that includes the
code. Should be pretty easy to adapt.
Hey, I want to change the intensity of an LED using PWM with the inputs obtained from the accelerometer.Could you please tell me what changes do i need to make?(It would be really helpful if you could share the code with me).
If you want to use PWM to do this, just place PWM, a pin, and in
PWM datasheet are the APIs to change its period. You would start
the PWM, then use the controlling API's.
In previous post reset pin should be tied to logic 0.
Another way is to use the PRiSM module, specifically for this purpose.
Start to module and use APIs in datasheet to control 0 - 100 %.
Hey, I want to control the intensity of the LED using the accelerometer can you tell me how should i do it? (If I make a gesture along the x-axis then the intensity of the LED should increase each time I make a gesture.)
In code basically you take your reading from accelerometer and convert it
to PWM compare value which sets its duty cycle.
So if PWM is 8 bits, you have to convert the accelerometer value to a range
of 0 to 255, and write that value to PWM compare value using API.
void PWM_WriteCompare1(uint8/16 compare) ( for UDB based PWM)
So say you accelerometer is a 16 bot value, PWM is 8, then right shift the
accel value by 8 to extarct its 8 MSBs, and write that using API.
Note set period to something like 100 Hz or faster to avoid any blink effects.
Yes, thats correct. You perform A/D conversion on each channel of accelerometer
and convert/range that to PWM range. Ideally A/D bit resolution would be >= PWM
resolution. The faster A/D is sampling, the faster acceleration event can be handled.
Hey, Thank You very much, it worked. Now, I want to receive the analog signal of the accelerometer through Xbees. I have configured the Xbees in API mode. How should i proceed?
Regarding the XBee: how are they configured? What is listening on the other side of the XBee link? Did you read the XBee manual, and set it up correctly?
Configuration of Xbee(Receiver):
Zigbee Coordinator API
Configuration of Xbee(Transmitter):
Zigbee Router AT
D0/D1/D2- ADC (2)
Set the Sampling rate
(USED XCTU software)
I want to receive the analog signals of the accelerometer via these Xbees?Now , How should I proceed? can anyone share an example program to which i can refer to?(atleast for wireless communication using xbees)
That is not an error, it is a warning. There are some lines flagged without any rason especially in PSoC3 Keil but when you compile your project the warnings and errors shown are relevant.
Check the message and check if the called function really exists.
Do you have an actual, PSoC-related question? I suppose you have already read the xbee documentation, and did come up with a plan how to use it.
Do you want to connect the accelerometer directly to the xbee, and then send the data via it? Or should the PSoC read the data and transmit it via the xbee? What is on the other end of the xbee link?
I guess xbee-only related question are out of the scope of this forum. Here you can find PSoC experts, but most of them won't know about xbee at all. So maybe you should try to find a XBee forum, and ask there how to work with analog sensors.
This might help -
The link on this page to msu is no good, maybe go to msu website and do some
searching, maybe you can hook up with the student or a prof and get a code
base. Or contact Patrick Kane if still at Cypress to see if he can supply a contact.
A link to a PSOC 4 solution, maybe you could port it ?
Another possibility -
If you mean you have several signals and you want SW to control which
signal the A/D looks at answer is yes, use an analog mux at the A/D input.
If you do this pay attention to notes on settling time when you switch from
one mux channel to another.
I think it wouldn't be too bad when at this stage you start to open an example project for PSoC3 and ADC and study it together with the appropiate datasheets.
The Xbee module takes serial data in, modulates RF and transmits over a RF
link, and then demodulates back to digital to send over serial UART. You need on
transmission side to "frame/format" the data sent in order to decode the data stream
on the other side back into its "values" and associated source of measurement.
This is briefly discussed here.