- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've the PSoC 4 BLE pioneer kit. I want to use an external potentiometer to control the LED. My questions are:
1- what are the pins that i should use to connect the potentiometer (i.e. VCC, GND). In other words, i want to use the power pins in the board instead of using an exernal power source
2- If i want to use an external power source what should i do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The interconnections of the BLE Kit are shown in the kit's documentation which you will find in
C:\Program Files (x86)\Cypress\CY8CKIT-042-BLE Kit\1.0\Hardware\BLE Pioneer Board
when you used the standard installation path. Have a look into the -pdf files.
Applying a voltage to the pin that usually drives the LED might work, but could damage the PSoC when the pin is not in Hi-Z mode, an externally applied voltage might quite sure blow your BLE Kit.
Controlling LED brightness is not just as easy as controlling a light bulb. LEDs should be driven at a constant current which easily works with a fixed resistor as (Vdd -VLED) / R shows, VLED depends on LED-type, typical 1.3V for red LEDs, 1.7 for green,, up to 2.7V for blue and whites.
So another commonly approach used (ie. for car backlights, you might have seen this already) is to switch the LED on and off periodically with a high frequency (200Hz). The ratio between on and off time is named "Duty cycle" and can be between 0 and 100%, which is exactly how we want aN LED to be controlled. A Creator component featuring this is the "PWM" that has adjustable properties as "Period" which you should set in a way that together with your incoming clock you get a frequency of the above mentioned 200Hz The other property "Compare" you may vary between 0 and the period value to get the above named duty cycle of 0 to 100 per cent.
The next problem is: How to "read" the potentiometer value?
Well, here the ADC comes in handy.
Connecting VDD and GND to the ends of your potentiometer will give an adjustable voltage on the wiper which can be transferred into a number by the ADC. There is (as usual) an example project for PSoC4 using the SAR ADC which you should study and compare with the datasheet. I am quite sure that there is an example for the PWM as well.
Use the pins the build-process assignes, they will at least fit.
When having any troubles, post your complete project here, so that we can have a look at. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider using the PriSM component for controlling LED brightness.
It produces less EMI than a standard PWM approach.
To compute the series limiting R for LED Rled = (Vdd - Vled) / Iled
If using off board LED then use alternative connection, you get more drive
current and better Iled control.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bob & Dana for the valiable information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Gad to have been of assistance.
Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know that my question is naive, but i don't want to damage my board due to a wrong connection or a missing information from my side.
According to the kit's schematics, I can connect the potentiometer to VCC and GND of J1, then connect the wiber to any input pin such as p2[5] in J2.
Am I right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is quite correct. With PSoC4 you always should use Port2 pins for analog inputs, since only those are routed to the SAR ADC. Remember that there is a current floating through the potentiometer which should be limited to something like 1-2mA that turns out to be a yalue of 2k ohm.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
N o, what I wanted to express is that you should use a 1-2k ohm potentiometer.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your pot Resistance is govered by your allowed Pdiss on low
end and leakage current on high end. So for a 3.3V system a
2K pot would have a Pdiss of ~ 5.4 mW, not a big deal generally
speaking, unless battery operated, then wasting power directly
impacts battery lifetime.
On the high side you do not want pot IR drop to create errors at
A/D input. So you start by assigning an allowed error for A/D signal
path, then calculate if leakage of A/D input would exceed your pot
IR drop equivalent error. Note there are AC considerations as well
if response time an issue, eg. its not just a DC consideration.
Point of all this is in product design your calulate to confirm the
decisions you make are good engineering practice.
Regards, Dana.