Giter Site home page Giter Site logo

Comments (12)

TCIII avatar TCIII commented on May 19, 2024 1

@chrisl8,

I fixed the problem by changing the following in node 'Arduino.js':

LOOP_START: 33 to 1
LOOP_END: 119 to 16

Works great now. Very impressive light show.

Though the Flora NeoPixel Ring does not respond to some of the display commands in the beginning which is probably due to some differences between your LED NeoPixel string and the Flora NeoPixel Ring.

"BLINKY" in the Web Interface Behavior Panel works as expected now too: I can turn the LED light show on and off with the "BLINKY" button.

Looks like you need to make the node Arduino.js LOOP_START and LOOP_END variables in the 'personalDataForBehavior.json' file to account for displays other than the one you were using? Also, '#define LOOP_START XX' and '#define NUM_LEDS XXX' in the 'neoPixelControl.ino' code should be adjusted to be the same as in the node 'Arduino.js'.

Thanks for the help, much appreciated.

Tom C

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024 1

@TCIII

Looks like you need to make the node Arduino.js LOOP_START and LOOP_END variables in the 'personalDataForBehavior.json' file to account for displays other than the one you were using? Also, '#define LOOP_START XX' and '#define NUM_LEDS XXX' in the 'neoPixelControl.ino' code should be adjusted to be the same as in the node 'Arduino.js'.

Good idea. Leave this issue open and I'll add that.

I'm glad someone else found this code useful!

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024 1

@TCIII

Yeah, Adafruit has had that for many years. My guess is that the reason I used FastLED.h was that I was following a tutorial at the time. If I was going to do this again, instead of an Arduino and all of this manual code, I would use an ESP32 and the https://kno.wled.ge/ project, which is what I've done on other things.

from arlobot.

TCIII avatar TCIII commented on May 19, 2024

@chrisl8,

Further Troubleshooting

  1. Changed '#define LOOP_START 33' to '#define LOOP_START 1' in the 'neoPixelControl.ino' and reprogrammed the Uno R3.
  2. Ran Start ROS in the Web Interface, opened the Behavior Panel, clicked on 'BLINKY' and five seconds later the Web Interface went back to Start ROS.
  3. SSHed into the Rpi and ran 'kill_ros.sh' followed by 'start-robot.sh' and watched the startup sequence.
  4. Even though "useArduinoForBlinkenLights": is set to true, "arduinoStringLocation": is set to ID_SERIAL, and "arduinoUniqueString": is set to "Arduino__www.arduino.cc__0043_7503330323535170E162", the startup sequence USB device detection (UsbDevice.js) is not identifying the Arduino Uno R3 along with the other USB devices.
  5. To iterate, running 'find_Arduino.sh' determined that the Arduino is on 'ttyACM0'.

Based on this additional troubleshooting, can you suggest a path forward to determine why the USB device detection portion of 'start-robot.sh' is detecting all of the attached USB device except for the Arduino Uno R3?

Regards,
Tom C

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024

That code is not very "portable". I threw it together in one evening in order to add some lights to my robot for an event, and it has worked for many years, but never really been set up for easy use by various hardware.

You say that "start-robot.sh" isn't detecting the Arduino USB port. What makes you mention this? Is it claiming that it tried and failed?
I ask because I don't see any reason why start-robot.sh would care about the port for the neopixles, as they are not run by ROS.

If you run:
~/catkin_ws/src/ArloBot/scripts/find_Arduino.sh
does it find the port where the Arduino is?

If not, then your arduinoStringLocation and/or arduinoUniqueString aren't correct.

If that works, then
You should be able to start the light show without ROS running by going to a terminal on the Pi and running

node ~/catkin_ws/src/ArloBot/node/Arduino.js

Let me know what the output of that command is if it doesn't work.

from arlobot.

TCIII avatar TCIII commented on May 19, 2024

@chrisl8,

Thanks for the response, much appreciated.

The result from running '~/catkin_ws/src/ArloBot/scripts/find_Arduino.sh':
/dev/ttyACM0
Which is the result I described in my first post above when I ran 'find_Arduino.sh'.

The results from running 'node ~/catkin_ws/src/ArloBot/node/Arduino.js':

thomas@thomas-desktop:~$ node ~/catkin_ws/src/ArloBot/node/Arduino.js
/home/thomas/catkin_ws/src/ArloBot/node/Arduino.js:137
webModel.relays.find((x) => x.name === 'arduino').relayOn &&
^

TypeError: Cannot read properties of undefined (reading 'relayOn')
at Timeout._onTimeout (/home/thomas/catkin_ws/src/ArloBot/node/Arduino.js:137:62)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)

I think this verifies what I mentioned in my first post above in "Additional Observations" item #3: "Is the fact that I have no USB relays causing a problem with the 'Arduino.js' code?"

So how do I get around the "no relay" issue?

Regards,
Tom C

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024

Yes, this looks like a bug in the code. It tries to deal with alternate relay options, but clearly fails. I never tested it without the relays. The fun part is that I do not have the relays anymore either since moving to the Raspberry Pi.

I will try to look at the code and fix it later this week.

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024

@TCIII I pushed an update that attempts to fix this.

Try this:

cd ~/catkin_ws/src/ArloBot
git pull
node ~/catkin_ws/src/ArloBot/node/Arduino.js

and let me know if it works any better now.

from arlobot.

TCIII avatar TCIII commented on May 19, 2024

@chrisl8,

Thanks for the quick response, however no joy.

I did as you directed above and here is the results:

thomas@thomas-desktop:~$ node ~/catkin_ws/src/ArloBot/node/Arduino.js
<-READY
0,0,0,0,33,119,25->
<-BUSY
<-ADY
<-ADY
<-ADY
<-ADY
Then no additional output on the CLI.
No display on the Adafruit Flora NeoPixel Ring (16 LEDs) even though I changed the '#define LOOP_START 33' to '#define LOOP_START 1' and '#define NUM_LEDS 119' to '#define NUM_LEDS 16' in the 'neoPixelControl.ino' code.

Your Arduino.js defines the LED array as follows:

// Named pixels
this.pixel = {
LOOP_START: 33, // First LED on the top of the ring.
LOOP_END: 119, // My last pixel has no green :(

Where as I have changed the following in the 'neoPixelControl.ino' code to conform to the Flora NeoPixel Ring LED configuration:

'#define LOOP_START 1'
'#define NUM_LEDS 16'

Additional Observations:

  1. When I run 'node ~/catkin_ws/src/ArloBot/node/Arduino.js' I can see the Arduino communication LED blink rapidly so it is receiving the display commands.

  2. Could the above conflict cause an issue between 'Arduino.js' and 'neoPixelControl.ino' as far as the display goes?

  3. Also, even though 'FastLED.h' does support the WS2812 Flora NeoPixel Ring could there be a hidden problem with the Arduino code?

Tom C

from arlobot.

TCIII avatar TCIII commented on May 19, 2024

@chrisl8,

I try to adhere to the old engineering saying "If it ain't broke, don't fix it", however Adafruit has come out with a library specifically for the NeoPixel LED family and you might want to consider replacing 'FastLED.h' with 'Adafruit_NeoPixel.h' when you update your software.

Tom C

from arlobot.

TCIII avatar TCIII commented on May 19, 2024

@chrisl8,

I believe that I have uncovered a minor bug in both node 'Arduino.js' and 'neoPixelControl.ino'.

Both 'FastLED.h' and 'Adafruit_NeoPixel.h' assume that the first pixel address is "0", which it is, according to the Adafruit NeoPixel documentation.

The only NeoPixel configuration value required, according to the Adafruit documentation, when using either 'FastLED.h' or 'Adafruit_NeoPixel.h' is the number of pixels in the string.

When I set the 'Arduino.js' LOOP_START and LOOP_END to 1 and 16 respectively and 'neoPixelControl.ino' '#define LOOP_START' and '#define NUM_LEDS' to 1 and 16 respectively, the first LED in the string will not light because its address is "0" and not "1".

If I set 'Arduino.js' LOOP_START and LOOP_END to 0 and 16 respectively and 'neoPixelControl.ino' '#define LOOP_START' and '#define NUM_LEDS' to 0 and 16 respectively, the first LED does light up when the light show starts, however after a while the light show freezes up with just four LEDs, in a box pattern, glowing white in color.

I believe therefore there is an issue in the way the LOOP_START value and the actual address ("0") of the first pixel in the string are being used by 'Arduino.js' generating the light show pattern and 'neoPixelControl.ino' controlling the pixel string.

Comments?

Regards,
Tom C

from arlobot.

chrisl8 avatar chrisl8 commented on May 19, 2024

My 'blinky lights' still work, so I am going to close this out, as it has been a whiel.

from arlobot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.