2013-11-14

CooCox Raspberry Pi Arduino interface learning notes


Raspberry Pi + GUI to Control RGB-LED——Add PWM functionality to RPI with Embedded Pi - Coco Tuesday, 13 August, 2013

http://www.coocox.org/blog/?p=491#more-491

Raspberry Pi set aside some expansion interfaces to connect with peripheral devices and extend the functionalities, including SPI, I2C, UART and GPIO. However, Raspberry Pi has difficulty in controlling directly the modules which need to use PWM, such as the speed regulation of stepping motor, the brightness control of LED, etc., due to lack of PWM interface. Embedded Pi addressed this issue – Taking the advantage of Embedded Pi Arduino interface, we can connect modules like a stepping motor or RGB-LED to Embedded Pi via Arduino Sensor Shield; 

Raspberry Pi can control the stepping motor, adjust LED brightness, or acquire peripheral frequency through communication with the Embedded Pi.

Embedded Pi is a Raspberry Pi accessory specially designed by CooCox for Raspberry Pi fans and Arduino enthusiasts. As a bridge between Raspberry and Arduino shields as well as one between ARM Cortex-M3 and Arduino shields, the Embedded Pi integrates and blends the three communities together – Raspberry Pi, Cortex-M3 and Arduino. 

For detailed information, please visit http://www.coocox.org/epi.html.

This article introduces how to add PWM functionality to the Raspberry Pi using the Embedded Pi.

1. Principle

The MCU STM32F103 on the Embedded Pi is capable of acquiring signals. As the controlled terminal, the Embedded Pi receives real-time command of controlling PWM duty cycle from the Raspberry Pi (refer to here for the command frame format), decodes the command, controls the PWM duty cycle of specified channel in order to control the peripheral devices, and then returns the execution results to the Raspberry Pi via UART interface.

Next we’d use the demo of Raspberry Pi + GUI controlling RGB-LED to illustrate how to add PWM functionality to the Raspberry Pi with the Embedded Pi.

All visible lights in the natural world are composed of red, green, and blue light. Lights with different colors can be generated through changing the intensity proportion of the three lights. By receiving the RGB values from Raspberry Pi, the Embedded Pi controls the PWM duty cycle of specified channels to change the intensity of the there color lights in RGB-LED and produce lights with different colors.

Generally human eye will not feel the blinking of LED when the PWM pulse frequency is higher than 100Hz. Here we set all the frequencies to 1K Hz.

...

.END

No comments:

Post a Comment