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.
Bob
Although obsolete this kit had a code base interfacing an accelerometer -
http://www.cypress.com/?rID=38235 CY8CKIT-003
Juts go to the page for docs and ISO disk download that includes the
code. Should be pretty easy to adapt.
Regards, Dana.
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.
Regards, Dana.
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 %.
Note you should tie PRiSM enable to high, kill to low. I forgot to
do this.
Regards, Dana.
Hey, thanks for the help, the PWM part worked. Now working on the accelerometer part.
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.
Regards, Dana.
Hey, you mean the output of ADC right?(since I am using ADXL335 which is an analog accelerometer)
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.
Tradeoffs.
Regards, Dana.
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?
Also, If I want to control three different LED for each axis, then how should i do it?
How about just using three PWMs, one for each channel / LED?
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?
Consider using 3PrISMs, they will use less HW resources.
Regards, Dana.
Configuration of Xbee(Receiver):
Zigbee Coordinator API
Pan ID-100
Configuration of Xbee(Transmitter):
Zigbee Router AT
Pan ID-100
Channel verification-enabled
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.
Bob
oh thank you, I figured out the problem, can you help me with the xbee part? as in share an example project(API mode) for receiving analog signal.
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 have connected the accelerometer to the Xbee and then transmit it to psoc(via transmitter-receiver xbees).
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 -
http://www.cypress.com/?rID=52137
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 -
Regards, Dana.
Thank you guys for bearing me, you guys have been of great help.
Hello , How do I check whether an rx interrupt is generated while using UART block of PSoC3?
I would say: Set a breakpoint within the interrupt handler to check for an interrupt.
Bob
Or set a pin inside ISR and set scope to trigger on pin.
Regards, Dana.
Is it possible to give input to an ADC through software????If yes, then how should I do it?
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.
Regards, Dana.
No, I need to convert the analog sample data obtained from xbee packet into digital(correct me if I am wrong). I wanted to know how should I do that?
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.
Bob
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.
http://www.cooking-hacks.com/documentation/tutorials/arduino-xbee-shield
Regards, Dana.