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.
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.
Thanks Bob & Dana for the valiable information
Gad to have been of assistance.
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 in J2.
Am I right?
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.
So this means that i need to connect a resistor (i.e. 2K ohm) between the potentiometer and the VCC (as in attached figure) to limit the current entering the pin when it is connected to the VCC through the potentiometer.
potentiometer.jpg 11.9 K
N o, what I wanted to express is that you should use a 1-2k ohm potentiometer.
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.