Computer generated Magic Poi patterns with P5.js

Computer generated patterns – let me count the ways.

  • C++ code on-device

    – a simple for-loop using FastLED’s “Palletes”
  • Processing code – on Android, streaming to poi.


    – created using Processing “Mask”, the coloured parts of the image change colour to create an ever-changing image sequence. I also implemented a sound activated version which shows a pattern according to volume on different frequencies (“Beats”) and a static “Cylon” effect (“Zap Game”)
  • Similarly C can be used to stream generated patterns to the poi (see here).
  • I have experimented with AI generators using different prompts – for example:

    – These are from “Midjourney”
  • Finally, my current mission, using P5.js within the magicpoi website to generate pics with code. Examples:

Example:

The above example creates an infinite succession of 72x72px images – perfect for display on my 72px poi. I adapted the code from this showcase example on the P5js website.

My plan is to add this – and many more – options to the magicpoi website. They will complement the user generated images and be downloadable directly to the internet connected Magic Poi.

PS: Currently, if you want to see what any of the images generated above will look like on the poi, you can right click on the changing image, select “open image in new tab”, download the image and then on the magicpoi profile page (you need to be signed in for this to work – sign up, it’s free!) select upload and drag the image onto the page, or choose it from the file menu. Then you can turn this: into this:

As you can see, the possibilities are endless. I plan on making the P5.js image generation into a plug-in system for Magic Poi.

Upgrading the Magic Poi site

Currently the Magic Poi site relies on some Processing (Java) code which is called from python – as well as other bash scripts to do certain things. I wanted to make it faster and cleaner by using Python for everything, so I did some test scripts. (Github). Also, the Processing code required a virtual screen buffer to run on the server constantly!

The main functionality involves compressing images into the .bin files which are saved to the poi memory for display. Since there is limited memory, and to save bandwidth, I am using the R3G3B2 algorithm to compress images. The poi only accepts images which are rotated 90 degrees clockwise, so that needs to happen too, as well as dynamically re-sizing any images which are wider than the 72px available.

I am still conflicted about whether to keep the Android app as the control for the poi, or to do something else, but making everything available as an api on the server keeps it flexible for now. The RotateImageVisualPoiStyle api can be accessed right now. Upload your image, and see what it will look like on the poi!

# change the /path/to/image.jpg to your own image file name
curl --location --request POST 'http://magicpoi.circusscientist.com/api/rotate_visual_poi_style' --form 'file=@"/path/to/image.jpg"' --form 'fixed_width="72"' --output 'rotated_image.jpg'

MagicPoi – slow progress

Announcement:

The factory where MagicPoi were being developed had a fire last month! All of the prototype poi melted, so all I have left is my breadboard version. This is going to cause some delays..

Updates:

  • The Magic Poi website now saves .bin files for every image uploaded. This is accessible via an api which I am working on accessing from the ESP32 and ESP8266. The .bin files are byte compressed images for display on the poi.

    Example – list all shared .bin files on the server:
    curl http://magicpoi.circusscientist.com/api/get-filenames

    One thing to note is that for testing purposes, all new .bin files are shared now. Please be aware that your images could be accessed (temporarily). This is because authentication is an extra step, so I’m working on the basic functionality first, with a public folder. The authentication works using jwt and I am having to access it from Java and C++. I already have a working Arduino test code which implements jwt correctly – security is important, so I want to do it right. One problem I already had to overcome is the fact that LittleFS file system has a limit of 31 characters for filenames (including path). The randomly generated filenames on the server are longer than this.
  • Not sure if I mentioned this before, the SmartPoi “Upload for offline use” option in the Android app doesn’t upload the whole image at the moment. I am not sure why, perhaps it’s something to do with the timing loop moving to the next image too fast.
    This option is going to be replaced by the web api anyway, so it’s not a priority, but I have compiled a desktop app which I use for converting and uploading (Linux only). You can get that for 36px here or 72px here – it can upload 20 images, just drag and drop your pics (need to be 90 degrees rotated, unlike the website) onto the window, connect to Poi AP and press “Upload”. You need to extract it and run from the command line but it should work on any Linux distro (tested on Ubuntu and Arch).
    At some point I will probably get annoyed at having to use my Laptop to upload images and fix the app though. Do email me if you need this for Windows, I might be persuaded to compile it for you using a VM if you ask nicely.
  • With the new APA102 2020 version being more available now, when Magic Poi is eventually launched it will have at least 100px, I’m thinking 128 is a good number but don’t quote me.
  • You may have noticed all of the hype around AI lately. A few years ago I used GAN with PyTorch to generate images for the poi (after training with around 100 poi pics, probably not enough). It was a big fail, but maybe it’s time to take another look. Would it be cool if you could just tell your poi what type of image you want to display, and it did it instantly?
    I do already have loads of Processing sketches I made to try and computer generate nice pics (some are on the Android App).

Feedback is always welcome.

Smart Poi revisited

Magic Poi, with the firmware written in Platform.io and the web interface in Flask is the future. Currently I don’t have a working set*, though, and due to upcoming shows I needed to make some changes to the existing Smart Poi.

*Due to other commitments, the company who are doing the hardware design for me have put the build on hold for now.

Updates:

LiPO batteries instead of NIMH

I have resisted using LiPO batteries for my projects up until now, but since I was already getting some for my K8 equipment upgrade I bought some 1000MAH LiPO batteries for the 32px poi. The voltage regulator I have in the circuit (LM117) is not optimal for these, I believe that it is not using the batteries full capacity – but it does work!

Quick uploading of offline patterns

At the time I wrote much of the Android app which pairs with Smart Poi (in 2017!), I was set on having all of the patterns stream from the smartphone to the poi over WiFi. In the real world unfortunately I found that due to WiFi interference this was not possible at most venues, where the 2.4GHZ spectrum is saturated and the stream stutters. So I made a way to upload and display patterns directly from the ESP8266 flash. Initially this was done with UDP as the streaming was taking place, then I moved over to http post. The latest update to the app disables UDP while the post is being sent, so uploads are really fast. I hope to refine this and port to the 72px version as well in the near future. You can get the apk for the latest version (so far only tested on Android 10) here – any future updates will be made to the same file. *Please note that the text message option still crashes, I am looking at this as a matter of urgency! Also, on first run the app sets up some example images and may need a restart (possibly even a phone reboot) to work correctly.

Magic Poi Lite version

I am working on a ‘lite’ single colour version of “Magic Poi”. The plan is to eventually replace all of my juggling equipment with internet enabled equipment which can sync using a web interface, like “Magic Poi”. The first test page is up here: http://magicpoi.circusscientist.com/lite and includes a colour change function and a really cool “Automatic Poi Simulator” visualisation which was kindly shared with me by Danny Thomas from kaien.com. Eventually this page will have a timeline (to music) function, and ability to download to the equipment. The firmware will also include offline capability, which will disable the WiFi to save power during operation.

Many thanks to all those who continue to support this project. Smart Poi continue be a part of my performance every week. I’m inspired by the thought of enabling more people to make reasonably priced POV poi and other LED equipment which can do as much as, or more than the commercial versions.

As always, if you haven’t already, head on over to the Smart Poi Overview page and sign up to the newsletter for occasional progress updates. Feedback is welcome.

PS: did you know that every time someone visits my website, an LED flashes on my desk? I made an online service and open source firmware for the D1 mini which means that almost anyone with a website can have the same functionality. Check out https://www.circusscientist.com/led-website-indicator/ if you are interested!

Emulating Poi Spinning patterns in software

Several years ago I read an amazing scientific paper on the mathematics of Poi patterns, by DrexFactor – you can have a look at the web version here.

So recently I was thinking about it again and managed to plug some of the formulas into a Processing sketch:

Poi spinning emulation – first attempt.

I have always enjoyed emulation software for juggling, it’s amazing what you can do – juggle 100 flaming swords for example (or make an LED juggling emulator, like this one I made) Anyway, it turns out that there isn’t anything similar for poi spinning.*

Seems like there should be one.

*UPDATE: turns out there are quite a few. Thanks Reddit! Here is one of my favourites, done in Processing: http://www.kaiein.com/poi_auto_sim/

**UPDATE 2: Danny Thomas from kaien.com kindly let me use the code for my own emulator – I’m using this as the base for a new single colour version of “Magic Poi”, “Magic Poi Basic”. See the demo here: http://magicpoi.circusscientist.com/basic

Magic Poi 2022 update

Current state of Magic Poi – and some ideas for the future.

First of all, an announcement: Magic Poi is now available for ESP32, as well as ESP8266 architecture. This will bring improvements in performance. I plan on continuing support for both, and in the near future a combined code base will be provided.

I am going to list current features here, and improvements I plan to implement.

On-board images:

  • I have partnered with EnterAction, an awesome Sydney based fabrication company who are taking over the hardware development from now on. Improvements will include an SD card add-on for limitless on-board storage. This will require changes to the code, as currently the maximum is 52 images supported.

UDP streaming:

  • this is a defining feature of Magic Poi. The images are generated off-device, and “streamed” via UDP pixel by pixel. I plan to keep improving this functionality but change it to not be the default mode. Due to WiFi interference the UDP stream is sometimes interrupted, making the LED’s stutter, so work is being done to mitigate that.

“Timeline” – images changing in time to music:

  • currently there is a desktop app to generate the timeline (and associated images) and save as a zip file, which needs to be uploaded to the Android app in order to be “streamed” to the poi. I plan on changing this functionality to rather happen in the poi code, thus avoiding the WiFi interference problem. The timeline editor will be made into a web app, with the option to download directly to the poi.

Station mode:

  • poi connected to a router provides more stable WiFi than the current AP mode. I have made a start on providing a way to use this mode.

Online account:

  • like a PlayStation or Kindle, there is a benefit to having a cloud aspect to any product that consumes media. The Magic Poi website is going to be a place where you can upload and share images and timelines, as well as interact with other poi owners. All uploaded images will be private of course, unless shared. I have made a start on this cloud aspect, with an option in testing to download images directly from your cloud account to the poi. The ultimate goal is to be able to sync any two pairs of poi with two clicks!

Android app:

  • Still not working: text to image (stream words directly to the poi).
  • Once the online portal is finished, this will be added to the app, so shared images and timelines can be viewed without need for a web browser.

The above is a small part of the list – thanks to EnterAction taking over the hardware development side, I will have more time to devote to the software improvements. We also plan on adding a battery level indicator, and a higher power battery for more play time.

Thanks for reading!

Keep an eye on this blog, and sign up to the newsletter (if you haven’t already) for more updates as Magic Poi moves forward towards it’s inevitable crowd funder launch!

UPDATES:

Sign up for our update alerts:

Magic Poi Magic

SmartPoi is re-branding as MagicPoi

Magic Poi online portal
Magic Poi login screen

New stuff:

Check out http://magicpoi.circusscientist.com to sign in to the new experimental online portal. A place to upload and share poi images. I am working on a way to get the images directly onto your poi, straight from the server. If you have access to a linux terminal, you can test this using curl: curl http://magicpoi.circusscientist.com/api/get-filenames for a list of files in .bin format. Or just visit the link here to see all the files listed in a browser: http://magicpoi.circusscientist.com/api/get-filenames

To download a specific file you need to send a get request to the api like so: curl -X GET http://smartpoi.circusscientist.com/api/output/e5d2dd82008b343354a0f37ab435c32aab9dc132.jpg.bin -O -J -L $url – which will download the file and save in the current directory. Now that the api is set up, I have working poi code to get and display the images directly from the poi, so will be sharing this on GitHub once it is cleaned up a bit.

Oh and I finally managed to get the images to work right-side-up! So no more need to rotate 90 degrees before uploading.

coming soon:

There is a lot to do still, both on the server side and in the poi code. I recently switched over to PlatformIO, as the huge code base was getting a bit unwieldy for Arduino IDE. This is going to mean a huge re-write of everything, but will give me an opportunity to enhance things along the way, such as:

  • Built in web server on the poi, able to switch between Online and Offline modes, including access to the magicpoi.circusscientist portal (so you will be able to control and manage the poi operation from any browser) – I tried this already, the magicpoi site works in an <iframe>, and there are many open source libraries for the access point management.
  • Many utilities such as creating timelines, image generation, text to image etc on the magicpoi portal. Also a better user interface (looking at javascript gallery plugins, but first getting the basic functionality up and running)
  • Much easier poi sync and multi-poi control using mesh networking
  • Support for more poi sizes (72px is currently the default on the portal – or was it 80px?)
  • ESP32 support – this is inevitable, unfortunately my only ESP32 device broke, so this is on hold for now.
  • Many other hardware improvements being worked on (thanks Caleb!) such as accelerometer, ESP32, external flash, smaller embedded LED’s, battery management and more.

some notes:

The online portal is “alpha” quality, so please expect things to break. I have limited the image uploads to 10 per account, and the .bin files (for imaging on the poi) are all kept in one public folder for now, so please don’t upload anything personal or proprietary at this point. This is just for ease of use, as I haven’t set up security end-points for the poi – server connection. Passwords are hashed, however, so at least that much is secure (this means even I can’t see your password), and the server is kept up-to-date with security updates.

So what do you think about the Magic Poi project? So many people have emailed with stories and photo’s of their test builds, it’s hugely motivating, so thanks everyone, you know who you are! I need to do a blog post with some of the images I have received, many different versions of the poi being built and spun all over the world – will have to get permission from the individuals concerned first though.

It’s slow but steady progress, and I am getting more certain over time that Magic Poi could be a serious contender in the LED poi space eventually. At least in kit form, on Indigogo!

UPDATES:

Sign up for our update alerts:

SmartPoi going online

Recently due to Covid my focus has shifted from performance to full time programming. I now code for a living, and have done for the past six months.

Since my work project involves server architecture I have come up with a new idea for SmartPoi – what if I could use the full power of the internet on the poi? The idea is to have an online server which the Android app can connect to and retrieve images, timelines, and visualisations. Each Android app could be associated with an account, with private and sharing functionality (so we could share images – a bit like on the visualpoi site).

The first part of this new functionality I am working on is a virtual poi imager (see https://circusscientist.com/Axel_Belhache_Demo/ for an idea of how this could look). This will have a way to upload your own images, and eventually you will be able to create an account and save images there. The long term goal is to connect the online server with the Android app, and make it easier to get new images, and share them. *UPDATE: The test page is now live! Try it out by uploading your own poi images here: magicpoicircusscientist.com. Currently limited to 10 images, and they need to be rotated 90 degrees before uploading.. I’m working on it!

As an added bonus, it is possible to send images to the poi straight from a browser (someone asked me about that recently on GitHub), so there could be a web app which would make SmartPoi usable without the Android app. Some functionality is not possible, though, with web alone – such as streaming images straight to the poi. For security reasons (DDOS) web browsers don’t allow UDP sending from the browser. Luckily SmartPoi backup images are uploaded using http requests. This means that standard poi things like offline images will be able to be loaded straight from the website onto the poi soon. Possibly timelines as well. I also hope to add re-sizing of images and text image generation to the list at some point.

Just as a side note – due to personal circumstances I am not able to do any hardware work for the rest of the year. The SmartPoi kit Indigogo launch will thus not be possible this year. Coding work is still very much in progress (I recently updated the app to work on Android version >9. )

As always, if you want to be first to hear the latest news about SmartPoi, you can sign up using the form below. Many thanks to those of you who emailed me with images of your own SmartPoi in action, it’s great to know that my contributions are inspiring people to make their own. We are just getting started. Loads more to come!

UPDATES:

Sign up for our update alerts:

SmartPoi Update

There have been a number of changes to the SmartPoi project in the last year. Due to issues I have had while spinning them at gigs I decided to make some much needed changes. This is a major upgrade

  1. Changed to binary format to save images (in LittleFS file system) – this is so much smaller than the previous text based format, I can now fit 100 offline images onto the small poi and 50 images onto the large poi. The maximum image size is larger. Also, all images can be displayed one after the other. And the timing can be changed for offline images as well.
  2. Added setup code to the Android app – no longer do I need to run a separate program to set up the test images, the Smart Poi Demo app now creates the correct files and folders*
    *unfortunately, Google in their wisdom are removing file system access slowly in newer versions of Android. This means that my code is going to have to be updated once again (angry face emoji)
  3. Uploading offline images to the poi is simple and available straight from the Android app. An upload image button uploads all of the images at once (one folder at a time only for now)

The Future of Smart Poi

I am planning the launch of a kit version, hopefully this will be possible some time during 2021(*Update: more like 2022). The design will be modular, with the battery, circuit, and LED’s all coming separate. I have a friend who is a qualified designer who will be helping with this part. The idea is to be able to have a ‘snap-on’ LED strip, so that more pixels can be added at a much lower cost than if I was making a whole new set of poi. The same goes for the battery, and even the main circuit (ESP32 anyone?). If I can do it right, it will mean that upgrades will be cheaper and also easier.

The new poi will be known as “Magic Poi”. Future Magic Poi Website here (It’s a fun Visual Poi Comparison site for now..)

Try out the current code:

  1. Firmware (on Github)
  2. Android App (on Github) or download the .apk

Smart Poi Overview page… may be a bit outdated now. Things are changing fast. I think you will agree that it’s improving with time. The future of Visual Poi is here, and it’s modular, open source, and streams over WiFi!

Sign up to hear news and updates:

SmartPoi Code Dump!

2020 is the future! In the future I want to have many projects complete and be working on something new. So here is the everything I have been working on for the past few years, all in one go. Is this complete? You tell me!

I have uploaded the code to github, and some programs to my site, all is explained, although possibly in a rather rushed way.

Significant things which I have finally open-sourced (as promised) are the Android App (for streaming images and patterns to the poi), the full firmware for ESP8266, the circuit and PCB I used, CAD files for 3d printing and more.

Still to come is the code for uploading the backup images to the poi (an old windows .exe is available for now).

To read about how all of these programs work together check out the SmartPoi menu option above, which include the following 3 new pages:

  1. https://www.circusscientist.com/smart-poi-android-app/
    – description and code for android controller app
  2. https://www.circusscientist.com/smartpoi-full-circuit/
    – PCB, breadboard, parts and CAD files to make the hardware
  3. https://www.circusscientist.com/smartpoi-firmware/
    – ESP8266 code and description

If anyone is interested in making their own streaming poi all of the parts are linked.

Affiliate links are included on this website. Please support my future projects! Another way to support my work, and help yourself to free stuff at the same time, is to check out DigitalOcean with their promotional 2 months free hosting. If you haven’t yet heard of them, they are the best and cheapest virtual server on the market right now, use the link!

If you are trying to make the poi please consider signing up to the mailing list, I am emailing updates to quite a few interested parties right now. No spam, just updates. In the last two years there have been only four emails, so not a whole lot…

UPDATES:

Sign up for our update alerts: