Hello everyone. The past few days I have been trying to get my contraption to work. I am trying to power up a 12V RGB LED strip using an Arduino MKR 1010 WiFi and a 12V power plug, with the appropriate resistors and transistors used. I will attach a picture of my circuit below.
My Arduino board successfully connects to IOT Cloud (which is where I do my coding on, given this is an IOT Board), and the code even is shown to be successfully uploaded. I initially wanted to test my contraption, so I used a small test code as attached below:
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/6e50dd56-809d-4f30-acdd-0f7b830990d4
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float greenValue;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
int greenPin=2;
int greenVal;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
pinMode(greenPin,OUTPUT);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
analogWrite(greenPin,greenValue);
Serial.println(greenValue);
delay(1000);
}
/*
Since GreenValue is READ_WRITE variable, onGreenValueChange() is
executed every time a new value is received from IoT Cloud.
*/
void onGreenValueChange() {
// Add your code here to act upon GreenValue change
analogWrite(greenPin,greenValue);
Serial.println(greenValue);
delay(1000);
}
My aim of this code was to control the brightness of one color of the LED directly from my phone, so I created a dashboard with greenValue as a slider from 0 to 255. Upon uploading the code, the RGB lights do not respond when the slider is moved, and I am sure that I have successfully connected to the wifi successfully. The LED just remains brightly on. I will also attach a picture of the specs of the RGB LED strip in use.
Welcome! Why not post a simple schematic showing all of the connections and the EBC of the transistor. You did connect the grounds which is correct. How are you powering the Arduino? What transistor did you use? What is your load current?
There's no reason to know that the base is in the middle… and just trying different connection permutations is a recipe for destroying the device.
Use the part number and data sheet, or try something like
Also, are you sure it is a transistor? A recent thread had everyone busy while trying to make a temperature sensor part work, turned out to be a similar package but no a temp sensor at all.
@ UK HeliBob in the serial monitor, the values are being printed accurately when changed from the dashboard.
@PaulRB , yes the green LEDs seem to flash, and I did correctly identify the base, emitter and collector, and tried it with multiple transistors, just to make sure I didn't blow up one. I am using an NPN transistor, identified using the number at the back.
@alto777 after trying the above with multiple transistors, at one point I just resorted to trying different permutations with the transistor. While my arduino board and pins work correctly as identified by the blink sketch, is it possible I blew the RGB LEDs?
I have tried my best to answer all of you. I sincerely appreciate your help.
Thank you
Can you test the strip independent of the code? From your diagram, something should light up if you remove the transistor and simply jump wire the former collector point to the emitter point.
If you were expecting the transistor to work to turn something on and off.
That's all the NPN transistor can do in that configuration - look like an open or more or less mostly closed switch.
Now the LED strip does not even light up. The transistor in use is a 2N3904. And the blink code, while it works for a normal LED, does not work for this strip. And I do not have a digital multimeter. Thank you for helping out!
Hello, yes the RGB LED does light up when I directly connect the power plug to the LED Strip terminals. However, it does not work in the contraption I have wired as shown
Thank you for your time!