I would like to extract the live sled X/Y position data from WebControl (I’m running v0.94), live while it’s operating.
My end goal is to have it output on the Raspberry Pi’s GPIO serial TX pin which I will then send to a custom DRO display based on a Wemos and a cheap custom daisychainable 7-segment LED single digit board built out of WS2813s.
I figured that since I can see the data live in my web browser on my laptop then it must be possible to scrape it out via some sort of http client if there isn’t a better way.
Can anyone guide me on potential ways to get that data out live? A scraper tool perhaps. Or an area in the source code to look at modifying with a hook that spits it out to a temp file.
I’m happy to work on parsing it and outputting it on the serial port myself once I have a live stream source for it, but any help appreciated
I did this for the raspberry pi display with the display running in a separate process rather than encumber the main python loop with one more thing thinking a remote display not connected to the rpi could do it via the web if desired. It was a bit involved ( for me anyway). The updated code is in my repo and should be viewable…
You get the code via a get/put command to the rpi ip address and port with the keyword of interest. Then a JSON packet with the data is returned.
In the code image above from the link, the “get” command is “Status” and the returned packet should have sled location and home location.
These status information packets are coded into the newest version pull request for webcontrol.
Thank you Orob! That is exactly the sort of headstart/shortcut I was hoping for
I had seen the photo of your GPIO buttons and LCD display in another post; I didn’t realise it was driven by an rpi.
I’m hoping to parse the data down to just X/Y as integers and push them out via TTL serial to the Wemos.
I’ll post photos once it’s up and running but meantime this is a picture of two of the 7-segment displays daisy-chained together. If anyone else wants these I can provide the files and they can be made very cheap in low numbers (eg 2, 5, 10 etc) by jlcpcb.com.
Are those 3 color LEDs so you can change the number color? Have you tried one of these displays?
Yep that’s correct - RGB LEDs.
I was planning setting the display up with 3 digits close together then a gap then another 4 digits. This will allow me to show from -600mm to +600mm and from -1200mm to +1200mm assuming the centerpoint is 0,0.
I was thinking I would show red for numbers below zero and green for numbers above zero and maybe blue for exactly zero.
Yes I’ve seen the displays you mentioned (thanks for the link), but I decided to go with these boards I designed instead because I’ve used them in a couple of other projects too so I have a few spares. They also have a 12V-5V converter on each digit. Their brightness is very consistent as well as high
I made a pinewood derby track display with one of those in the link, but RGB is a step up.
My next little project (from a year ago) is a pendant from a classis nes controller with pi zero inside that has a 0.91’ oled graphic display on it to show position and act as a context menu. Since all communication between server and client is http PUT/GET this remote can function alongside a web browser and issue any command as if it were the webcontrol web page. The issue I had with using the Bluetooth Wii remote was there was no display. This fixes that… In theory.
Wo, how retro! When it’s finished it will be almost a good as using a cheap phone for a pendant
Just kidding - it’s a very cool project! I love the idea of jogging the Maslow with an NES controller.
It wouldn’t be that much work to make a circuit board that fits in there and holds the OLD and LED in place. I’d be happy to help with that if you ever wanted to give it a spin.
But right now I’m getting cosy with main.py in WebControl… Thanks again for the tip
Hello again @orob
I’ve had a look at your version of WebControl and the modifications that you have made look to already include all the feature I need! Thank you so much for sharing your work
It appears that if I were running your version of WC then I would be able to poll the URL http://127.0.0.1:5000/LED and I could do that in a separate python process a couple of times every second and drop the output onto the RPi’s GPIO TX.
Where I’ve come unstuck is that I’m out of my depth in terms of understanding how to ‘compile’ or install your version alongside or overtop of my existing setup. Don’t worry, I’ll backup first!
I can see that the main process executing on my rpi is /home/pi/webcontrol/webcontrol and when I look at that file it appears to be an ELF binary. I’m (somewhat) used to editing and executing python source code, but I have no idea how to turn my git clone of your source into an ELF to replace that one (if that’s what I should be doing to install your version?).
Please could you give me some high-level tips/pointers or refer me to any links that would send me in the right direction on how to mod my config to use your version?
Or if you have an SD image for it that I’ve overlooked then let me know (oh ever so hopeful
I’m glad to hear the time I spent getting this feature to work might be useful to someone other than just me. How about a prerelease version here? From the code page you were looking at, on the right side of the screen, there is a “releases” link and you can pull the rpi version from one of the links there (which is the link shared above).
To answer your question: if there was no compiled release version, you would need to download and install all the python libraries and then run webcontrol from the source code. This would make it easier to modify code and try it out changes. For what you are doing though, you should be able to modify the /Services/MaslowButton.py file and point the received data to your display setup in the format required.
The 0.957 version has the /LED command you mentioned. The /Status one was from a different earlier version and I don’t know why it is now called /LED. It should be /Status. I’ll change that for the next release unless you want to leave it. Your call since you are the requestor. Also the default port :5000 is now changeable in the settings so I have been using 5555 or some other random number. This matters if you have another program (like makerverse) that runs on port 5000 that cannot be changed.
oh one more thing: don’t flash with the firmware bundled with the version of webcontrol even though the warning comes up when you load webcontrol that you are using an older version. just click ok and or acknowledge it and it will work fine. That firmware doesn’t work with all boards and has some “special” features you may care to avoid: features like “runaway sled mode” and “don’t respond mode,” to name a couple, but I’m sure there are a couple more undiscovered features that might be discussed on another thread.
Orob, your continued help and tips are extremely useful. Thank you for taking the time.
Heh, “runaway sled” mode lol
which is why it isn’t finished yet… though once the menu system is done, it potentially could be better or at least faster and potentially more intuitive for those of us with fat fingers and small phone touch screens.
Here is a different approach posted in the Community garden long time ago http://maslowcommunitygarden.org/Big-Z-value-display.html by using an arduino mini to sniff the TX pin
It may be useful
Thanks josm! Gosh I can’t believe I didn’t think of that. Here I am thinking I should pull the position from the RPi via serial but it’s already going out to the Arduino via serial! So why not pick up the data there…
you could probably echo the serial port TX in software on the rpi and parse the coordinates from that… That could also be simpler than a socket IO connection and requires no soldering.
I have been meaning to get back here for a number of weeks and post a follow up with how I got on.
Big props to @josm for the tip about the Big Z display and it’s way of sniffing the return serial data from the Arduino. I ended up taking that approach and it allowed me to build a ‘single wire’ solution which uses a length of UTP cable to pull 12V and RX serial from the Arduino into my display.
The display itself is a daisy-chain of 7 single-digit numeric RGB LED displays housed in a box with a frosted acrylic cover. The 7 digits are split into 2 groups of 4 digits and 3 digits. The X position (integer milimeters) is displayed on the 4-digit side and the Y position on the 3-digit side. The Z position is displayed periodically in another colour and also immediately for a short time after any time that it changes.
The code, board design and bill of materials are all open source. JLCPCB will make these for you in single digit quantities very economically and they will supply built with all of the parts except for the FPC (ribbon) cables used for daisy-chaining displays and those are available very economically from eBay.
If anyone wants to have a go at making one then I’m very happy to answer any questions. I would also recommend adding more digits so that the Z position can be displayed all of the time. It’s cool watching the X and Y move around, but it’s the Z that really matters when you leave the maching going and you want to glance over at it to work out what number pass it is on.
I put all of the files in a github repo here:
I tried to make a Maslow Community Garden posting with the same but got 405’d. I shoulda believed the bit that said ‘disabled due to spam’ lol
You are a genius! Wish I had the skills to do this stuff.
very nice! Thanks for sharing. I need to rebuild my maslow button controls. I like the large numbers. Your description made it sound like you used a hard wire input to the ESP32. Do you think an arduino nano could parse it fast enough? or maybe a pi pico? I have one of those laying around that could do something similar.
I was hoping to see a pic of your populated board - found the one above.
Edit: nonworking link didn’t work when pasted in browser, but works clicking through…
There is a picture of a couple of the populated boards further up this thread (in a posting from me dated Dec '22). I could take a photo of the back if you want me to, but there really isn’t much to see on the back. If you want closeups of anything or have any questions just sing out and I’ll provide any info I can
I just tried the oshwlab link again now in Firefox on a Mac (not logged in) and it came up fine. I was able to click ‘Editor Open’ and it opened the design in EasyEDA web editor (again, not logged in). What error did you get when it didn’t work for you?
Whoops sorry just realised I didn’t answer the query re Nano or Pico - yes absolutely they would be fine as long as the NeoPixel library supports them. I initially designed the boards to be driven by a “Wemos D1” (ESP8266 CPU) because they are cheap and I have many of them. However I pivoted during development to using the ESP32 because I really wanted to have two working hardware UARTs - one for debug serial console and the other to receive data from the Arduino. I spent way too long trying to make SoftwareSerial work on the D1 before changing to the ESP32! But as soon as I did, everything fell into place
So my only caveat is that you might want to use something with >1 hardware UART if you plan on modifying the code.
I saw the board above. I was more curious how the esp32 was connected and thinking you made a board to connect it to the LED’s. the link I pasted into the post above didn’t work in a browser address, but it works when clicked in the forum, so the error on that was on my end somehow.