Smart Poi

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)

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:

Creating an app for Android Gingerbread in 2020

Whatsapp has officially revoked support, Google says 0.2% of devices accessing Google Play are still running it. I explore the difficulty in targeting a 10-year old version of Android.

Step 1: Search the internet

Maybe I’m using the wrong search terms but this is a bit of a bust. Google likes to showcase new shiny things. My search did come up with the above information regarding Whatsapp and also Google removing support (if you want to target the Play Store) but how do I do this for just my phone?

Step 2: Just go for it

I am using Android Studio. What if I just choose Gingerbread in the settings from a new project? Will it work?

Ok, it turns out that I only have lowest Android 4.0 (Ice Cream Sandwich)
I need 2.3.3 (Gingerbread)

Let’s check the SDK settings in Android Studio – I am sure I installed all the correct target libraries years ago, what is the problem?

SDK tools says Gingerbread is installed. Google says no!

Step 3: What happens if I plug the phone in?

Android Studio and ADB recognise the device. API level is 10. OK in my new project I go to build.gradle (why are there two, couldn’t they just call the one you need to edit something else?) and change API level to 10 (target, min, compile) – now what? Wait some hours while Gradle does it’s magic. I’m waiting for my laptop to be depreciated by Android Studio to be honest, it’s such a resource hog! (pro tip, if your laptop is running too hot, check out cpulimit on the command line. Or just get a job and buy a new one..)

This is turning out almost as bad as React Native, which I had a look at the other night – 1 hour to get to a “Hello World” app to work. Admittedly I was installing the framework from scratch…

So far so good, Gradle hasn’t thrown any errors, I’m installing the basic Gingerbread app now…

Oh snap! ConstraintLayout not supported on Gingerbread. Do I want to override this warning and install anyway (or use another layout, what did people use for Gingerbread back then?

Install anyway Gradle lets find out if I can get this thing to run. I love ConstraintLayout, most of my apps use it!

Ok nah, Android support v7 library has moved past the whole “Gingerbread” thing (AKA they DEPRECIATED it). Time to start again – I may need a new test project..

Support v4 library has minimum API 14, same as Support v7 library.

So far no luck compiling anything for my old phone with Android Studio.

Let’s Try Github

There’s loads of old code on Github, clone and install something from +5 years ago when Gingerbread was still supported?

OK success. I went and imported a project (https://github.com/andmatand/knitknit-gingerbread/) 44 commits, somebody put some time into this knitting tool for their girlfriend (it says so on the readme)

Then I had to specifically choose not to use the latest versions of libraries, add maven (all guided by Android Studio) and voilla. The thing installs.

This is pretty hit/miss. But as a proof of concept I will take it. I want to use my old phone for something, maybe as a streaming webcam, we used to use it as a baby monitor when my son was little. Now I can make my own apps for it.

Next up: Installing Ubuntu on my S3 mini (using PostmarketOS) and running some good old c – and is there any point in doing this if you can just install Termux?

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.