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:

Why you should hire a juggler (Or the similarities between learning to juggle and learning to code)

Learning new juggling moves is a task that benefits from breaking down into smaller, more achievable goals. In this respect it is very similar to learning a new coding language or framework.

Take my favorite 3 ball juggling move, for example: the Box.

In order to learn this we need to work out what is going on. There are three separate throws, two going up (one in each hand) and one going across.

Steps to learn the box:

1. One ball, up, across, up again

2. The hard part on both sides, with two balls (simultaneous up and side throw, not very intuitive but once you have it, it feels great)

3. Go for it. if you spent enough time on step 2, you can do it!

By the way, the example above is from https://libraryofjuggling.com/

Similarly in programming we have to break tasks down into pieces, only putting them together at the end. Recently I got a new job building an online app using Flask, JavaScript and a little bit of JQuery, Jinja and something called “Tabulator” for web tables (and Bootstrap for buttons).

Learning

Previously I had only worked in Android (Java) and Arduino (C++), so at least the syntax made sense on the front end, but in order to get the basics down I started by going through the FreeCodeCamp examples. Once I knew how to call a function, parse an array, set up a library and so on it was time to move on to the next step – building a basic program which works.

Finally I gained enough understanding of the inner workings that I was able to add/remove features without being afraid of breaking things and could start to enjoy building something.

Deploying

In Juggling, I learned that being able to keep up the pattern without dropping is only part of the process. As soon as I wanted to show off my new moves I was faced with another set of problems to solve. After some more practice, I learned that every juggling routine needs a flashy start and finish (to get people’s attention). It’s also important to be able to juggle without looking at the pattern, while talking at the same time.

In the software world this is called deployment. Personally I like going with my own Ubuntu based server (hosted by Digital Ocean ) but there are many options out there, each with their own different requirements to learn. The new job I mentioned is hosted on Google Cloud.

Conclusion

Conclusion and take away message: practice is always an important part of learning anything, but the basics need to be covered at first and you should definitely hire a juggler.

Check out my CV! (soon to include Python, Flask, JavaScript, Jinja, Google Cloud Services, and more)

ESP8266 libraries treasure trove

While looking for a new WiFi manager for my SmartPoi project, I stumbled upon a great resource: https://www.arduinolibraries.info/architectures/esp8266 – a list of Arduino libraries broken down by architecture.

Just having a quick look, I have noticed some great libraries to help improve my ESP8266 based projects (I haven’t had a chance to look at these yet, but looking forward to it!):

some interesting esp8266 libraries:

  1. https://www.arduinolibraries.info/libraries/esp8266-timer-interrupt
    – interrupts for ESP8266! So useful.
  2. https://www.arduinolibraries.info/libraries/esp_eeprom
    – Speed up EEProm and add wear levelling
  3. https://www.arduinolibraries.info/libraries/firebase-esp8266-client
    – Firebase? On ESP8266? Sounds like a challenge!
  4. https://www.arduinolibraries.info/libraries/mini-grafx
    – graphics library, not sure which displays this supports…
  5. https://www.arduinolibraries.info/libraries/process-scheduler
    – process scheduler, is this easy to use though?
  6. https://www.arduinolibraries.info/libraries/restfully
    – hopefully this is better than doing it manually
  7. https://www.arduinolibraries.info/libraries/rich-http-server
    – more http requests wrappers
  8. https://www.arduinolibraries.info/libraries/settings-manager
    – store settings in .json
  9. too many WiFi config libraries to list here, I saw at least 15!

These are only the few I was interested in personally, the site lists 244 libraries for ESP8266. Check it out!

Advanced Arduino editing part 2

Now that I’ve had a chance to play with it for a bit, I really like VSCode a lot.

Here is my current setup for Arduino editing:

  1. Added arduino-snippets plugin (autocompletes arduino code such as “millis()” or “loop()”
  2. in c++ highlighting plugin (installed by default), disabled error squiggles
  3. right click and open folder (the one with the .ino files in)
  4. terminal (within VSCode)
  5. arduino –upload main.ino

The above setup does require Arduino to be installed and set up separately. The upload command for example is part of arduino install and uses the last settings (board and com port for example) that you set inside Arduino IDE.

I still think I might move over to Platform.io eventually, but at least with this setup I don’t have to re-do all of my code.

Advanced Arduino Editing

My favorite practical Arduino project is getting a bit large for Arduino IDE, so I am looking to move the development over to a “real” IDE. During the past few months I have enjoyed using Visual Studio Code (on my laptop running Xubuntu) for HTML editing. Since they have plugins I thought I would give it a go.

First attempt: Platform.io

Platform.io has some impressive marketing out there. They also support esp8266 which for me is a must. Unfortunately it is another setup which requires an entire rewrite of the code (renaming all .ino files to .cpp for example) and for the amount of projects I have lying around and return to regularly that’s a definite pass. *UPDATE: unless there is no other choice!

Arduino Plugin:

There is a nice plugin for Arduino, however. It does require you to already have Arduino set up on your system (check). To set up the VSCode plugin you have to point it to the Arduino installation folder.

https://maker.pro/arduino/tutorial/how-to-use-visual-studio-code-for-arduino

The ESP8266 is also supported! (you just need to add the board repository, kind of like how you add it to Arduino)

I also found a plugin to upload spiffs (esp8266 file system). https://marketplace.visualstudio.com/items?itemName=kash4kev.vscode-esp8266fs *UPDATE: unfortunately spiffs is now obsolete and there is no upload option for LittleFS, the upgraded replacement.

So far in testing the whole thing works, uploading sketches just the same as Arduino, except now I have tab completion(the IDE completes your commands for you when you press <TAB>) and advanced syntax highlighting. Best of all, VSCode comes with Dark Mode!

I think I might enjoy it, going forward. The only issue so far is that VSCode is no lightweight, it seems to be using a fair amount of resources to run. Nowhere near Android Studio, however.

*UPDATE: Unfortunately the Arduino plugin somehow fails to support multiple .ino files for an Arduino sketch (!!!!!). Here is the bug report: https://github.com/microsoft/vscode-arduino/issues/271

This is simply unusable as a result (sigh)

Guess I’m having another look at Platform.io – for lack of alternatives!

If you stumble upon this post and have a solution please send me an email tomjuggler at gmail dot com

PS I did try the alpha version of Arduino: Arduino Pro IDE https://www.arduino.cc/pro/software but it’s just that, alpha. 106 Errors in my code? But it still compiles and uploads fine?

Whatever happened to processing.js

I have mentioned this before, Processing is the greatest tool to code for me because it provides easy access to so many creative coding options. The main reason I love it so much is because it is cross-platform. I use the same code on the web, desktop and mobile apps (Android).

Now one of those options is less accessible for many new coders. Namely, processing.js.

What is processing.js?

If you don’t know, processing.js is simply a way for your processing (JAVA) code to be translated into JavaScript and run in a browser canvas window.

Why is it cool?

I love processing.js because it’s the easiest way to use the same code and get web-based sketches running on my own server. Just include a processing.js file and the processing sketch (with a tiny bit of html) and it works.

What to do now?

Processing wants us to start using P5.js which is the functionality of Processing but using JavaScript syntax. I am mainly an Android and Java programmer, so for me this is an unnecessary step (mainly involving changing all int’s and floats to var) and I personally will continue using processing.js.

But they took the website away!

Now we come to the reason for this post: they took away the website! If you try and go to processingjs.org website now you will find it’s been taken down by the maintainers. Only the github code is left for posterity. Well luckily there is always the wayback machine: https://web.archive.org/web/20180510071709/http://processingjs.org

Processing.js is alive and well. It’s still working on my site, you can see a load of them all over this site, and on my cv even.