I multiplexed successfully and combined the sketch with the LIS3DH and the TCS34725 sketch! So now I have the capability to send all the sensor data I want to Max over serial. I just need the sensors and the multiplexer to arrive in the mail to actually do it....
There is one problem though. Sometimes sensor data in the string gets dropped. Like it would print out perfectly 18 or 20 times, then one or two strings would only have the data from on or two sensors. Then it would go back to normal again. I think this has something to do with the arduino sometimes not reading all of the sensor's data fast enough before sending it out over serial. I made a workaround in Max with a [zl.len] object and a [gate], where it does not let the string through if it does not meet the minimum length. When I have the arduino set to print out the data as fast as it can (within milliseconds), the skipped strings are not noticeable for the purposes of music making. But that doesn't solve the problem, it's just a workaround. I've posted in the arduino forums to see if anyone can think of a real solution because I'm stumped. Neopixels are cool. I have a WS2812B strip that I was saving for a different passion project. And then I thought since I'm using a colour sensor, it would be really cool if I could add the lights to the hamster ball in order to have some visual feedback of what colour it is sensing. (of course I would use a light diffuser and a separate battery to power the LEDs). I was able to successfully combine the arduino sketch that changes the LED colour with the colour sensor, with the sketch that I previously made with the multiplexing, accelerometer, and colour sensor. However this caused a new problem. 1) I had to print extra HEX colour data to drive the LEDs, and that messed up my beautiful strings that Max could understand. So it prevented any sensor data from getting to Max properly. 2) The Adafruit Neopixel library slows down printing any sensor data to approx once/second, which is way to slow for making a musical instrument. I searched the problem and I'm not the only one with this issue. So for now, the idea to add the LEDs is on hold. I do have an idea that probably will work. It's where I have the mux/LIS3DH/TCS34725 sending their data to Max like before. And then make a Bpatcher that sends colour messages from the colour sensor to another arduino that has the LEDs setup. I did a quick search to see if other people have tried to drive these LEDs with Max, and lots of people have: https://cycling74.com/forums/connecting-led-light-strip-neopixels-to-max/ But this will take extra time to figure out, so it is better to just continue making the instrument as planned without the LEDs and if I have time, then figure out how to add the LEDs. Now I need to get this baby wireless!
0 Comments
Leave a Reply. |
Welcome!If you are looking for a summary for my Masters thesis, it is here. Archives
October 2023
Categories |