PB3 won't go past loading screen, now stuck in wifi setup

Hi @wizard - I spent an hour on a screen share with popcapps just now, and wanted to relay some of what I saw.

Since client mode has never worked for him (even back when his v3 was loading the patterns page just fine), he had the clever idea to just change CLIENT to AP in this:

curl -i -d "mode=AP&ssid=MYWIFINETWORK&passphrase=MYPASSPHRASE&discover=true" -X POST http://192.168.4.1/wifisave

What we were able to observe was that it would create the AP, allow the Windows computer “we” were on to connect, but would not assign an IP. No gateway was shown in ipconfig; the interface self-assigned an IP. Contrast this with when he held the button for 3 seconds. In that mode, the Pixelblaze_XXXXXXXX SSID was connecting and assigning him an IP fine.

From that working Pixelblaze_XXXXXX SSID, /update was redirecting to /?wifi. I also helped him compose a curl form-data POST to /update with the @v3.16.pb32.stfu, but that also returns the HTML with embedded window.location redirect.

Hopefully this delete trick will work out. I think you said future firmware will allow POST to /update from WiFi setup mode, right?

And @popcapps - I know you were concerned about recovering a pattern you put some effort into. The delete of index suggested in the latest shouldn’t affect your patterns.

Jeff, thanks for the comment about pattern safety! Made me feel a little better about sending a command like that. Also thanks for the zoom call. That was unexpected and super cool to try and work through the issue (and even weird that we managed to reproduce it on one of your devices)

OKAY! So we’re back in business. Deleting the index and pushing a firmware update seems to have brought it back.

I want to mention that the delete command wouldn’t work in the pre-installed version of curl in windows. I had to move back to a mac to run it. It was not happy with the http in it. I’ll upload a screenshot when I go back to that computer.

AND THANK YOU BOTH SO MUCH! This support has been amazing.

1 Like

Not that it matters to my experience, but I’m sharing because it seems strange, but it must have pushed the firmware update and installed correctly, but is still displaying v 3.11 on the top bar while I’m connected to it.

Yeah, “AP” is the right value. It’s CLIENT, AP, or SETUP.

Wow, that does sound pretty hosed. This sounds weird and close enough to the 2 “WiFi not saving” reports that makes me wonder if not only the html file was corrupted, but perhaps the nonvolatile memory stuff the ESP32’s use to store network settings. I might take the approach of nuking that whole part of flash when it’s put into setup mode.

— Just saw your post —

Glad it’s working! Wow, thanks @jeff, thats super cool.

I think perhaps it just reinstalled the web page, if the status bar shows 3.11, then the firmware part didn’t complete (it updates in 2 parts, the page then firmware), which is a bit odd! I know you tried all the different kinds of power to get it working, but I wonder if power issues could explain the initial corruption, what power were you using during update?

I’d export all of your patterns (less to worry about!) then I’d try disconnecting the LEDs, power via USB, and try running the update again. You wont cause any serious problems using the newer web app with an older firmware, but the new firmware has quite a few stability fixes that I’d recommend.

2 Likes

So status for the next day. Last night I ended up deleting every pattern from the device and trying the firmware update again. I successfully got it to accept 3.16 as it’s lord and firmware. At this point, I’ve added about 15 patterns back onto it, and one time it’s freaked out and forgotten that it had LEDs attached, what type and how many. The map was unaffected (and has been this whole time I just felt the need to include that). This PB3 has forgotten its pixels in this manner many many times.

Additionally, I’ve tried to set up a different router for it to connect to, in attempts to get it to function in client mode and test that out. Still not having any success in that route, either through curl or the wifi settings page. I’m not positive if it’s not connecting or what, and haven’t exhausted trying different settings on the router and whatnot. Is there a specific type of security or anything I should set it up as?
All my phones and computers can connect to the ‘CarlHost’ network I’m creating with no issue. Eventually I’ll have enough data and have tried it on enough networks to know if it’s just my stupidity or something weird in the device itself.

All in all, client mode isn’t going to be all that important to me, especially not in the short term. The pineapple that this contraption lives in is very mobile and It was a huge selling point to me that it can operate in AP mode.

I’m just psyched that this thing works again!

Also, as far as memory on the device goes, it seems that I’m very good at finding the limitation on that. How do I manage that better? Is it expandable? How much memory is it? Do I delete the comments from the patterns to save space? Is there a way to know how much space I’ve used at any given point? I see the memory readout in the top bar but that never really seems to change much for me.

I come from a world of video footage where terabytes are thrown around like hockey pucks and this world feels very strange to me. There’s probably close to 100tb of external hard drives on my desk as I write this.

I realize there’s a lot of rambling questions in there. I turn 33 in a couple days and there hasn’t been something in my life that I’ve understood so little about in a very long time and it’s exciting.

1 Like

@popcapps ,
I’m almost certain that your Pixelblaze is browning out due to low voltage, and is tripping one or more of the fail-safes. At 2 reboots it will skip loading a pattern, and at 3 reboots it will forget pixel settings (even in settings page) - but those are temporary unless you change a setting. Giving it a cold boot should bring everything back.

If it gets to 4, only then would it forget the map temporarily, and loading the tab would bring it back (unlike the settings tab).

At 5 it will go back in to setup mode.

When this happens next, would you poke into a hidden variable for me? The reset code is sent up to the browser in 3.16 but not displayed or used yet. I hope to add a brownout warning message in the future.

Open the page in a desktop browser, then open your browser developer console and enter this in the console:

lastStatus.rr0

Let me know what it is!

For storage, there’s enough for about 100 average patterns and the web app page, but only just so. I plan to rework updates in future versions so that it doesn’t need additional reserve space for a second temporary copy of the web app. Another factor is that I’ve discovered is that the filesystem has performance issues as it nears full, and can cause some things to time out.

How much are we talking? Almost as much storage as the save icon could store :floppy_disk:. The chips used in V3 Standard and Pico use 4MB flash, with 1.4MB of that carved out for patterns and the web app. The rest is needed by the firmware to allow updates (needs 2 copies of that too). While there are larger flash models available for the Standard’s form factor ESP32 module, thats the limit for the ESP32 Pico (without adding external memories). Definitely something I’m looking at for V4.

The next update will have a simple free storage space indicator in the UI on the saved patterns list. Also with the ability to update firmware in setup mode, I’m confident there would be a way to recover a botched upgrade, and will remove the old web app before writing the new one, which should mean requiring a lot less free space to update.

BTW, this is what it looks like when configuring client mode successfully:

wifi_setup

Where does it get stuck? What do you have your Wifi setup up like? It needs a 2.4GHz network, they still don’t make a 5GHz ESP32. WPA2 is the most common.

Also Happy Birthday!!!

I realize there’s a lot of rambling questions in there. I turn 33 in a couple days and there hasn’t been something in my life that I’ve understood so little about in a very long time and it’s exciting.

Welcome to the world of microcontrollers! Where every byte counts, and you are so close to the hardware you can count the electrons as they go past…

2 Likes

Does anybody else hear the LEDs?

Thanks! It was a really great one. Drank beers in a park and then went to a late night driving range and tried to hit an old car with golf balls. One for the books!

The process of events described there is 100% as it is happening to me. I’ve used this LED array (240 or so pixels in a helix) and Anker 20,000 mah battery pack (well, three of them in total (only one at a time, over the course of a weekend) with some other random smaller ones as backup) for coming up on four years now, off and on with either one or two usb power leads hard wired to a Pro Micro controller with no apparent power issues.

I’ve let it run for a few hours at a time since your request to check that variable, and every time my result has simply been ‘1’. I’m going to let it run overnight and see if I can get a different result!

I guess I hope I do to provide some sort of concrete evidence one way or another about power. Any time I’ve probed it, no matter how I’ve had it hooked up, I’ve gotten what I have to guess are good readings. Is there a specific voltage that is considered low? I’m kind of new to testing electronics, so I’m not sure if 4.85 and 4.98 volts is much of a difference. Or is it supposed to be exactly 5 and nothing but the truth?

As far as memory is concerned, this is just a whisper of a thought, but is it expandable at all? Not that I’m really in danger of writing a piece of code complex enough to really need it, but just a genuine curiosity. I’d guess that it was a sort of failure point removal choice to utilize the same memory space for standard or pico?

And on the front of the client mode setup, for either of the networks that I try to connect to in client mode, it will complete all of those steps, but I’m never able to connect to 192.168.4.1 on the network I’ve pointed it to after it completes this step and the setup wifi network disconnects/disappears. It’s likely not going to be an issue for me until I get further down this rabbit hole and get into syncing multiple of these up. I’d be willing to screen share an attempt at what’s happening there, or demonstrate my power setup to see if there’s anything that I’m doing wrong, but I won’t live under the expectation that every time I have a question, someone will just drop everything to look at it.

I’m here to try and actually learn not only just how to code, of which my last experience was making basic websites about BMXing in the early 2000’s, but also math, of which I’m learning I have essentially no understanding of (I somehow managed to mange it through high school and college never having taken anything more advanced than algebra). I can kind of dissect and play around with pieces of other people’s code, and I’ve learned countless tips and tricks from everybody’s almost excessive commenting (thank you all), but I feel completely overwhelmed with where to begin. I’ve had a friend come over a few times and we’ve managed to figure some basic ideas out, but it’s as close to button mashing as is possible in code form. Perhaps some of the coolest inventions have come from just simply asking, “…but what if we multiplied v times v…again?”

Seriously though, where do I begin? I know it’s mainly javascript, but even in that world there seems to be a lot of factions. And don’t even get me started with math! I had to call an electrical engineer to help me modify newscrewdriver’s glowflow helix map to fit mine, and when I asked another friend who’s a software developer at uber, he looked over a couple patterns I shared and told me that if I manage to learn and really understand the math involved, that I should go apply to work at google, and then explain it to him. I take that with kind of a grain of salt, understanding the coding universe is seemingly very collaborative and share much of their workings with others. The video editing world does not work this way and I really wish it did.

Hi @popcapps ,
Glad you had a good birthday, 1/3rd centenarian!

For Client Mode, where you connect PB to an existing WiFi network, you won’t access it with the 192.168.4.1 address. That’s only for AP Mode. In Client Mode your router gives it an IP address, and you can find it on the discovery service page.

Hmm, how about lastStatus.uptime/3600000 ? it should show the uptime in hours. When you notice things missing, is the uptime low like it had just restarted?

For power, this is very tricky because the period of time that can cause these resets can be very short. When Pixelblaze uses WiFi it can burst up to 600ma for a handful of milliseconds. If the power supply can’t keep up for that short window, it could cause a reset. It might read 5V on a multimeter, but a dip to 2V for a handful of milliseconds wouldn’t show up, you’d need an oscilloscope to see a dip that fast.

Power banks can go to sleep when power draw is low, or internal temperatures too high, which can also cause a reset.

I would add a large capacitor (several hundred uF at least) and see if that helps. Sometimes switched power supplies like those in USB battery packs can’t react to rapid changes in power draw fast enough, and a large capacitor can help with the small burst power needs.

Memory is not currently expandable with what exists today. It could be done, and something I’m looking at for future versions. It’s technically possible to do on an expander board, but the time and complexity to make that work probably isn’t worth it.

By the way, button mashing in code form is exactly what PB was made for, and a completely valid approach. Just look at the real time feedback, both in the editor as syntax errors, and the LEDs to see what your changes are doing. Keep the code in a valid state as much as possible, and make small changes iteratively so you won’t end up too far down a dead-end. Discovery and invention through quick trial and error is what it’s all about! Do that for a bit and you start to intuit what things will do and build up a set of “tools” you can use. Also reading code is harder than writing it. I’d play with the artistic side of LED coding once you have a basic setup working, plus it’s more rewarding.

1 Like

Ha! Well that seems pretty obvious now. I’ll check that out after work and confirm my ignorance to basic network administration…

I will also try this later!

I let it run overnight, and the battery is almost depleted now, and my result to that query was 16 and some very long decimal. So when left to it’s own devices, it seems to be okay, it’s probably just when I’m telling it to do something that makes no sense to someone with any idea of how to code.

I suppose as far as the learning aspect of it goes, I keep seeing Javascript light mentioned, and wondering if that’s just referring to the subset of javascript that you’ve allowed into the PB universe or if that’s a specific subset of javascript that I can look up and familiarize myself with syntax. I’m supposing that’s what you’ve defined below the pattern editor, but it’s mostly greek to me. A lot of it is written as “assuming you already know the entire universe of javascript, here are your limiting bounds” which is likely the case with the vast majority of people who pick one of these up with plans to create their own visualizations. I’m guessing the best answer in the long run, outside of the scope of this specific device, is to just buck up and put some time into learning the world of javascript.

I do keep running into something that I can’t seem to figure out, which is getting my 3D helix arrangement to work with any 2d patterns. It would be neat to get text scrolling working, just as a plane wrapped around a circle.

Here’s a screen shot of my map. It’s the glow flow map, which was where I initially found the PB, modified to show correctly on my smaller diameter helix (I think it’s 3.5")

Yeah, it’s a subset of JavaScript (or JS simplified perhaps). That is to say, syntactically it is ES6 / JavaScript, but functionally is missing many things that make JavaScript what it is.

It is not an official / common subset, this language was created for Pixelblaze. I would have used another language, but the real-time coding requirements meant that there wasn’t any existing compiler I could use. So I built one based on a JavaScript parser. As a language specification, it is easier to say it’s JavaScript light and list the limitations.

If you go learn JavaScript, you’ll learn about objects, prototype chains, and APIs (functions/objects) that don’t exist in Pixelblaze. Your “hello world” program will probably use text strings and console.log, both of which are absent from PB. Pixelblaze’s “hello world” is a rainbow. So it may not be immediately applicable, but once you start solving problems in JavaScript, that same thought process and at least some of the tools can be used in Pixelblaze.

If you forget “JavaScript” for a moment, there are some things that are common to several languages, and those are key for writing pattern code. Stuff like variables, expressions, functions, loops, and that sort of thing are common across many languages. In C-like languages like C, Java, JavaScript, etc., you have for and while loops, if for conditional code, curly braces for code blocks, array access with [] and that sort of thing in common.

The pixel mapper tool is different - that is real JavaScript and it runs only in the browser.

Without changing anything about your pixel map, you can get a wrapped 2D surface by converting the x,y coordinates into an angle. That does require some trig, but we’ve already done the work :slight_smile:

A while back I uploaded a pattern called “angle and radius from coordinates” to the pattern site. Here’s the relevant bit (updated for atan2)

//return the angle as a value between 0 and 1.0
//most of Pixelblaze's animation language uses this range
//it also happens to rotate the angle so that 0 is north
function getUnitAngle(x, y) {
  return (PI + atan2(x - .5, y - .5))/PI2 
}

This assumes your center point is at (0.5, 0.5), which it would be for your 3D helix. Pass in the X and Y from your render3D, and you get back a value from 0.0 to 1.0 based on the angle from that center. In other words, it’s a value that walks the circumference of your circle. Combine that with Z as the up-down dimension, and you have a 2D surface wrapped around your cylinder!

As far as electronics go, 4.85 is bad, 4.98 is acceptable, 5.05V is optimum.

LED strips don’t care so much, many of them will work at 4.5V, but microcontrollers won’t.

Having said that, many microcontroller (like the PB) work at 3.3V, and the supplied 5V is regulated down to 3.3V, the 5V is only used to supply/drive the LED strip. That’s 3.3V minus nothing though, if it goes below that for even a microsecond, you get a reset - which is what the capacitor is for.

By the way, JavaScript was invented by Demons in Hell to torment people who know real programming languages (like c).

Fortunately, the PB isn’t really using JavaScript, so it’s easy to program, and you don’t need to get into the madness of actual JavaScript.

4 Likes

(ROFL @Nick_W … I’ve always thought that about Javascript too.)

Let’s not hate on JavaScript too bad, I don’t want to discourage people from learning it on the way to making beautiful pixels. Fortunately you don’t need to learn the JavaScript-isms to make good use of a Pixelblaze.

I also wanted to add that both LEDs and Pixelblaze will be happy with a solid 4.5v.

Below that, some LEDs can drop in brightness somewhat, and colors can start to shift. Some addressable LEDs work well down to 3V. Pixelblaze itself needs about 3.2V. However, sudden changes of a volt or more can cause issues and the regulators might have a hard time keeping up.

You can run a Pixelblaze and LEDs straight from a 3.7v lipo battery btw, if you aren’t too particular about exact color/brightness. This will usually be much more stable than those 5v battery packs which internally boost a lipo to 5v.

1 Like

That’s good to know. I was wondering about using 3.7v in some hoops and hadn’t played with that yet. Knowing it should work helps.

1 Like

I’ve run dotstars and neopixels from 3.7V lipo battery’s with 3.3V microcontrollers directly (no buffer chip), and they work fine.

You can just about run them at 5V with a 3.3V mc directly as well, but you are on the edge of not triggering correctly. There is a trick I have used of putting a power diode in line with the 5V supply to the LED’s to give a little more signal headroom.

Most strips have disclaimers about potentially not working properly at these voltages though.

Should not be an issue with PB as the buffer chip boosts the signal voltage to the supply voltage.

Okayokayokay so this is another place where I get lost. So i have to make a render3D, and then put a render2D below it, but if there’s a render3D it just shows that and not the 2D after it in the code.

I’m feeling increasingly dumb now, because I spent longer than I care to admit trying to add that bit of code into any pattern anywhere, and then try to do anything with it at all, I’ve not managed to make any noticeable difference at all. I think that’s the hardest part of learning so far is what to do when nothing does anything.

I am immensely grateful for all of the support, but I think it’s time to go get some base understanding of how to talk to a computer effectively.

Also, is the following tutorial the norm, or are there really decent places to learn?

Do people use things like skillshare, etc?

Aiming for the 3D render is somewhat ambitious when you’re still learning to code!

Do you learn best by tinkering, video, or reading?

If tinkering, play with the included “An Intro to Pixelblaze Code” pattern. If video could be something like this, and reading is a good fit for the recommended subset of Codecademy JavaScript.

1 Like