K8 Virtual Juggling with working remote

K8 are my favourite type of LED juggling equipment. Recently I updated my virtual juggling web app to include a working remote control – just like the real thing.

The App

So the app consists of an animated juggler, a remote control and “Change your pattern” button.

While the juggler is juggling, you can press buttons on the remote to change the juggling ball colours (accurately emulating the actual K8 equipment settings)

The “Change your pattern” menu is a large list of different juggling patterns, which when selected will change the animation displayed.

How it works: back end

The back end is based on Flask. I am using the beautiful soup library to fetch the menu of juggling patterns from the awesome library of juggling website. Once selected, the gif of the pattern is fetched. It is then processed (a script inverts the colours and makes the juggling balls transparent) – if that hasn’t already been done for the particular pattern.

How it works: front end

The juggling animation and remote control are written with P5.js. The juggling ball colours are implemented as a background which shows through the transparent balls. The button co-ordinates are relative, so work on any size screen (looks best on Desktop)

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:

I made an LED indicator for my portfolio site

Job hunting is tough – I’m busy until February 2022 but already feeling anxious about finding the next gig. That’s why I wanted to give myself a bit of an incentive – a visible indicator of success. I decided that whenever someone visits my portfolio site, I wanted an LED to light up. Read on to find out how I did it (using Flask, http requests, and an ESP8266)

Self Hosting

I recently had a bad experience with an online service shutting down on me – had a bit of a rant about it, although in the end it wasn’t too serious – but I am now determined to do self-hosting wherever possible *disclaimer: my current work project is hosted on Google Cloud, and I’m using Firebase and push services for some Android apps also.

The Flask api

The first step was to create a simple Flask api to facilitate tracking of site visits. This is based on this minimal flask api template on GitHub. I used a simple global variable to keep track of website visits because I’m doing this in my spare time and because it works fine – and I love boolean switches. Here is how it works in one simple gif:

Think of the hand as a visitor to my site, and the “switcher offer” is the ESP8266 at my home checking the api (the switch)

HTTP request from resume site

Since I am learning React my portfolio site was a good way to have another look at the framework. I used this single-page React resume site template as a base, adding my own details and an http request to the Flask api endpoint on load.

ESP8266 code

I used the basic http requests example with my own api details, and added in EEPROM code to record the incrementing number of visitors to persistent memory. The ESP8266 module checks once per second with the api whether there has been a new visitor to my site. If there has, the built in LED on my D1 Mini switches on. Although I have mostly moved over to using PlatformIO, for this very simple sketch I used the Arduino IDE.

Deployment

Like I said, this one is self-hosted. I’m using Digital Ocean droplets, which are a fixed cost of 5 dollars per month, for as many sites and services you can cram on there (trust me, it’s a lot). The React site was surprisingly simple to deploy, just build, copy the build folder and point Nginx at it. Flask is a little bit more complicated, compared to how easy it would be on Google Cloud, for example, but a few config files are really not too much to handle.

The result

Whenever someone visits my website, the LED lights up. Simple as that. And I can plug in and check how many visitors I have had. I’m hoping that one of those visitors will like what I do enough to hire me next year!

Visit my site https://devsoft.co.za to light up my visitor tracking LED.

Potential improvements

If I was making this into a product, I would certainly upgrade the Flask API to include a database to keep track of the number of visits, rather than doing this on the ESP8266 EEPROM – which maxes out at 255!* Obviously this could include a web interface for accessing the information, I could log the times… But most of this tracking stuff has been done already – analytics for websites. Perhaps the ESP8266 could pick up some of this information and display it on an LCD screen. A flask service for accessing Google Analytics from Arduino perhaps? Let me know if this is something you are interested in!

Also, proper authentication – if this wasn’t just for myself… JWT, rate limiting, CRUD endpoints and a web interface to change LED behaviour.

And maybe an RGB LED would be nice, then I could add in some of my other websites, in different colours!

*apparently the Arduino EEPROM library works differently on ESP8266 – ignore that part of the code, I need to update it (the counter still increments while the module is plugged in, though)

Goodbye Fritz.ai, goodbye proprietary online services

Fritz.ai “sunsetting services”:

Fritz.ai is (was) a cool service for, in particular, making machine learning apps easily. The marketing hype was slick, and they roped in a lot of developers to help them push their service to many devs, particularly in the Android space, with paid articles on medium, and on their website.

First of all, I have to say, I take full responsibility for this, and I don’t blame anyone at Fritz.ai for my problems, it’s their service, they can do what they want – but I wasted a lot of time learning how to use their api, publishing my own (unpaid, no affiliation) posts about the service, and using it in apps published to the play store. Their business model seemed clear – free to use but once you reach a threshold you have to pay for the service. Seems legit, probably was legit.

My Android apps didn’t take off, so I never reached that threshold, never ended up paying for anything at all – but I did waste a lot of time making apps using a service which is getting switched off at the end of the month (August 2021). In other words, my apps are going to be switched off, for the (very) few users who did install them. If I want to continue with these apps, they will need a substantial re-write. In many ways I’m lucky that the apps were not successful!

So I have learned a valuable lesson here:

The lesson is: don’t trust your work to “flashy” or “new” products and services. I could have spent a week back then just learning the ins and outs of tensorflow on android, and done it myself. Just because I’m lazy doesn’t mean I’m stupid. Lesson learned.

*here is the full unedited email for those who are interested – I still don’t see any mention of this on their site or blog:

We’re Sunsetting Fritz AI


Service will end August 30, 2021


Hello,

This email is to let you know that we will be sunsetting the Fritz AI mobile machine learning platform, effective August 30, 2021.

What does this mean for my account?

As always, any custom trained models, datasets and annotations are exportable. Please see this documentation for how to export datasets and models.

After the sunsetting date, access to the Fritz AI SDK, webapp, API, and hosted services will be discontinued. All models, datasets, and resources stored in Fritz AI will be removed.

For mobile apps, the Fritz SDK will lose API connectivity, but on-device model inference should continue to function. Regardless, we advise you to update your apps, removing the Fritz SDK and models.

Snapchat lenses do not depend on the Fritz SDK nor API, and lenses should continue to function as before.

Why are we doing this?

Fritz AI’s mission has been to make the power of machine learning solutions available to mobile developers. When we started in 2017 there were few options available. In the following years there have been many great entries to the market such as ML Kit, Create ML, MediaPipe, Lobe.ai, MakeML, Firebase ML, and more. Now there is a mature ecosystem of tools, including free and open source options.

We understand that this decision will have significant consequences for our community, but we truly believe the wide range of incredible tools and resources out there will empower you to continue on without Fritz AI.


Sincerely,

Dan & Jameson
Founders, Fritz AI

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:

Monkey Detector Circuit and App

It’s been a while since I was so excited about a project. After much struggle (to do with a very hot voltage regulator) I have come up with a working circuit for the hosepipe tap trigger.

I was hoping to power the whole thing from 12 volts but the voltage regulator was getting a bit hot, and my main directive for this whole project is to not spend any money (otherwise I would have a relay shield like this one instead of the bare 5v relay which I had to trigger with a transistor)…

The other exciting thing was the Android app. I decided to create a stand-alone app which recognizes monkeys to put on the play store. Right now it plays a loud siren sound when a monkey – or baboon – is detected. I can’t even count how many times it would have been useful to have a simple alert which would warn me about vervets attempting to break in on the other side of the house.

Don’t get me wrong, I love the monkeys. They are really interesting to watch, their kids play in our yard, they do tight-rope on the telephone wires, and the troupes have all-out warfare sometimes on the road. The other day we found out that our neighbor’s dog has a pact with the monkeys: they open the bin for him and he helps them eat the contents. Just some monkeys and a dog getting along just fine!

So the Android app is pending review, it’s called Monkey Detector, I will add a link to it when available. My third play store app!

Update: Monkey Detector on Google Play Store – unfortunately some devices are having a problem where the app isn’t playing the alert sound. I am looking into this (it works on my phone…)

Monkey Detector – image for app icon

Mobile Monkey Detector

It’s amazing how machine learning has improved over the last few years. I was dabbling with TensorFlow for a while, then moved on to look at pyCharm, but ultimately I was going to go with the easy-to-use Google image recognition API for the mobile version of my monkey detector.

Then a few days ago I stumbled upon fritz.ai and their even easier-to-use pre-trained mobile classifier. Unfortunately the example was written in Kotlin, but anyone developing an Android app today should know that, so I gave it a go. Here is the tutorial on Medium (with link to Kotlin code on GitHub) https://heartbeat.fritz.ai/image-labeling-on-android-in-kotlin-using-fritz-ai-and-camerax-1466089b2e34

The current version of the app (detects monkeys but doesn’t send a signal to my WiFi connected sprinkler system yet) is here: circusscientist.com/seeMonkey.apk – now available on the Google Play Store!
In order to use it you need to give camera permissions before first run, otherwise the app will force close. Just point it at a monkey and get alerted* (pictures of monkeys work fine)

*If you are wondering what happens, my 6 year old son shouts “Hey you, get away from my lunch!” when a monkey is detected.

The next step is to adapt my Arduino controlled tap valve (more on this to come soon) to receive WiFi (using ESP8266 of course) and then send the signal from the app (in Kotlin…!)

I can’t wait to make the demo video, those monkeys are trying to get into the bin (and our house) every day, and they hate getting squirted.

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: