led strip emoji with FSR

Hello!

I am not sure if it's the right forum section to ask, but I don't know what causes the problem...

I have connected fsr sensors and digital led strip, which I have cut and soldered to create a kind of matrix, but with different amount of led's in each line.

What I need to do is to create different patterns - like emoji, I have numbered each in the scheme, the black ones, should light up (see the attachment).

I tried matrix code first, but the amount of led's varies, so I switched to pixel, and I use adafruit pixel libraries.

THE MAIN ISSUE - when I test same code with less led's working in the same time - everything seems fine (image in the attachment). But when I try one pattern from the attachment (more has to be working though) some LED's start blinking, while they shouldn't. And if I test it too long it just stays on, though when the value of force is below 30 it should turn off, after a while they fade out.

I assumed it's because of insufficient power. I test it while connected to my laptop. My teacher gave me an advice to connect the arduino to the socket, but it stayed same - blinking like crazy. I still think it has to do something with the power. But maybe it could be something else? The code seems to be working, soldering was triple checked not only by me.

Do you have any suggestions? How to power or change the code or anything?

P.S. Here is the sample of the code:

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif

#define PIN 6
int fsrPin1 = A0;
int fsrPin2 = A1;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(168, PIN, NEO_GRB + NEO_KHZ800);

void setup() {

pinMode(fsrPin1, INPUT);
pinMode(fsrPin2, INPUT);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
int fsrVal = analogRead(fsrPin1);
int fsrVal2 = analogRead(fsrPin2);

if(fsrVal < 30) {
strip.setPixelColor(1, 0);
strip.setPixelColor(8, 0);

}
strip.show();

if(fsrVal > 30 && fsrVal < 100) {

strip.setPixelColor(1, strip.Color(0, 255, 255));
strip.setPixelColor(8, strip.Color(255, 255, 0));

}
strip.show();
}

pauline_besse:
. . .
strip.show();
. . .

That sounds entertaining !
Anyway, if it only stops working as you expect when more LEDs are powered up, then it does sound like a power problem. An arduino pin can supply max 20-40 mA and the total over all pins is max 200 mA.
Sometimes it is possible to power a device in such a way that it does not go directly through an Arduino pin, depending on your circuit.
If you supply a schematic and a link to the devices you are connecting, you may get more help.

Yeeeeah... pretty entertaining :slight_smile:

I hope it's understandable.. the scheme (or kind of) is in the attachment.

At the moment I am not using a battery/other power supply, so it's not on the scheme yet.

I am using:

I need to make at least 60 led's work at a time.

Do you maybe have suggestions on power supplies if you think it's the problem? Power banks for phones/ipads are not enough. I was going to make one myself with multiple batteries (like AA, but bigger), parallel connection and power regulator.

For my 5m long LED strip, I bought a 5V 10A AC adapter on eBay for about $15-$20.

The schematic is clear enough, but what I can't see is how with a LED strip you are going to implement that structure which appears in your first post. For example, how are you going to illuminate square 39 separately and without illuminating say square 51 at the same time? Are you intending to use some hardware to extend the number of pins available on your Uno ?

As for the power supply, you can see the sort of power requirements that say the Adafruit equivalent of your LED array has: Adafruit NeoPixel Digital RGB LED Strip - White 60 LED [WHITE] : ID 1138 : $99.80 : Adafruit Industries, Unique & fun DIY electronics and kits

If you use a separate power supply, and join its low voltage ground conductor with that of the uno, then you can use a transistor, controlled by a pin on the Uno, to connect the LED array to the additional power supply, without overloading the uno's power supply.

Could you please make a scheme of how to connect transistor and power supply?

the 'matrix' is connected to pin 6, numbers of led's that should light up are in the code sample and it works perfectly, don't see any problem here. The picture of led's didn't upload last time, will try to upload it again.

The only problem is that it doesn't light up normally in case of lighting up too many led's - it blinks.

I'm not sure - the code is pretty huge because I address each led, but I guess arduino uno can handle this amount of information. Could that be an issue?

P.S. the structure should be portable.

ieee488:
For my 5m long LED strip, I bought a 5V 10A AC adapter on eBay for about $15-$20.

Thank you! But it's AC, I need DC. I mentioned batteries because the structure should be portable - it's actually a part of a mask...

Now I see. Your LED arrays elements each have a controller. They are not simply dumb strips of LEDs.

Look at Tweaking4All.com - Arduino - Controlling a WS2812 LED strand with NeoPixel or FastLED. You'll see a schematic there. It is simple because the same voltage used to drive the Arduino is used to drive the LED display. Note the differences between fig. 4 and fig. 5. If you are also using the USB connection, then you must use the schematic in fig. 4.

The 'AC' in the AC adapter mentioned before refers to the input and not the output.

Thanks!

But you think that the only problem is power - not something in the code, arduino or else ?

Also this is about connecting led to the socket as far as I see (AC). But it has to work with the battery because it's a part of a mask, a person wearing it has to be able to move and dance. But I don't know if there are existing batteries or power banks that can give an output of 4000 mAh.

The symptoms you describe indicate that it is a problem with power.

You should be able to test that easily with a second power supply connecting it as illustrated in the link above (fig 4). Do not use the circuit in fig 5 . That power supply could be an AC adapter as illustrated or a battery pack.

You could also use 3 "D" Cells in such a holder http://www.memoryprotectiondevices.com/img/BH3DL.jpg to see how long they last. According to here, Alkaline "D" cells can have a capacity up to 12000 mAh. List of battery sizes - Wikipedia

You have other options for batteries as well like lipo which might be more appropriate for a "wearable" system.