I’m back Hello, Youtube! And Welcome to HeathenHacks! Just a heads up, this is going to be another multi-part video. This first one will mostly include the test and initial code that we will improve and / or add features or functions in the following weeks. Better watch out for those, if you want to. Today, we are going to make a bike seat or backpack mounted bike signal that would show right or left arrows depending on what direction we choose to display using the PS2 Joystick Module. It would also display or turn on all the red LEDs on the matrix when we choose to signal STOP and all green LEDs if we choose to signal GO. The use of a Joystick Module instead of buttons was actually inspired by one of my Arduino Projects. Click here to check it out. And as always, ALL THE NECESSARY LINKS WILL BE PROVIDED IN THE DESCRIPTION DOOOWN BELOOOW ~LESGO! Here are the things that we need… An Arduino Nano. I tried it on a Mini, but the Mini can’t store all my code. A PS2 Joystick Module as the controller An 8X8 WS2812B RGB LED matrix And finally, a few jumper cables. First up let’s get some wires. Jumper cables are just as fine but, I haven’t used my spools of wire for a while now, so might as well use them. Red wire for the positive lead black for the ground and yellow for the data. The connection is pretty self-explanatory. V- for ground V+ for 5v and IN for Data-In. Ok, let’s proceed on soldering. Just going to add this UV filter and- Just going to add this UV filter and use it as protection against possible solder flux spitback. Now, let’s add some solder first before attaching the wires to make our life easier. Ooook. Aaaand there you go. So, I just did some tests using the FastLED library examples and the initial code and apparently, all of the 3 WS2812B matrices that I have ordered are all malfunctioning. As you can see here, I have added a 470 ohm resistor to possibly fix it if it was a signal issue. I also used a separate 5 volts 3 amps power supply to provide power to it, but it’s still acting weird. All 3 of them are like this. Completely unusable. Now, I’m going to remove these things and try it on a matrix that I have used on the Independence Day Tribute video which you can see right here. I’m not sure if the malfunctioning ones are from a bad batch or something. And although, I can just remove one from this panel and use it I don’t want to. For the meantime, I’m just going to use this for testing and buy a new pair in the future. The white one is for the 5 volts green for data and blue for ground. The previous tests that I have done confirms that it was not because of signaling issue or lack of power because even without a resistor or a power supply connected, this matrix is working just fine. Now, let’s try our initial code and see if it would work. Launch VScode. Wait for it to load… Click on Import Arduino Project Search for the Project Folder There’s our Initial Test Code Click on Import Wait for it… There you go. Then ugh.. Let’s connect our Arduino Board. After that, let’s check and see if it’s being detected. Alright, there it is on COM5. Then… Click on src. Here’s our initial test code. Now, for our code to work properly on VScode we need to include the Arduino Library. For some Quick Code Explanation, Vx is connected to Analog Pin 0 and once its analog read value reached a certain threshold it would display either the LEFT or RIGHT ARROW. On the other hand, Vy is connected to Analog Pin 1 and would light up all the RED or GREEN LEDs once a certain threshold is reached. Button is connected to Analog Pin 2 and would clear or remove the current display on the matrix when activated. NUM_LEDS is the number of LEDs on the Matrix And DATA_PIN or Digital Pin 2 is where the DATA_IN of the Matrix is connected. This one right here would display the Analog Read values of Vx, Vy and Button on the Serial Monitor every 250 milliseconds. Now, If X or the analog read of Vx is less than or equal to 88 First, it would clear what’s on the display, then show either the RIGHT or LEFT arrow It depends on the orientation. (of the matrix) The brackets and numbers after leds are the locations of the LEDs that would light up and CRGB are the colors of the LED. Now, If Y or the analog read value of Vy is less than or equal to 50 it would first clear what’s on the display and then fill all the LEDs with color GREEN. Then, If Y is greater than or equal to 900 would fill all the LEDs with RED. And lastly, if btn or Button is equal to 0, it would clear what’s on the display. Now, click on BUILD to check for errors. Build is the equivalent of Verify on the Arduino IDE, by the way. WOOOOAH. That’s a lot of red colors and seem to be pointing to attribute. HhHhhmMmMmmM… When this happens, you can try this. Click on Libraries. Search for the library that you are using. In this case, FastLED Then, click on installation Copy lib_deps or library dependency, then click on platformio.ini Replace this line with [email protected] to make our code depend on a specific version of the library just to check and see if the issue was because of the currently installed one. After that, click on Build. Build successful and no errors! ヽ(^o^)ノ Now, let’s click on upload. Then, click on Serial Monitor Let’s see.. So, when I push the joystick to the right, it displays the left arrow. When I press the button, it clears the display. Left. Clear. Right. Clear. Stop or Red. Clear. Go. HhHhhmMmmM…. Ok, let’s adjust the threshold a little bit let’s make it 80. Let’s try it again. Left. Right. Stop. And Go. Needs a little bit more adjustment Let’s make it a hundred then. Click on Upload Try it again. Left. Right. Stop. And go. There it is! Clear. So, as of now, the code is a little bit slow, right? It’s like lagging. The reason behind that is this. So, let’s just comment this to disable it. Then, upload the code again and try it again. Left, Right, Left, Right, Left Right, see, it’s responding quite faster now, eh? So, yeah. That’s it for now. Thanks for watching and see you again next week! Maybe.