SmartPoi – new Web Software to upload images.

I wrote some new code, so now you can upload offline images from a web browser! Finally the (old) poi can take advantage of the hack I did to have up to 52 offline images displaying.

First, install the latest SmartPoi firmware (otherwise the web upload won’t work) https://github.com/tomjuggler/SmartPoi-Firmware

Then clone this repository here https://github.com/tomjuggler/SmartPoi-js-utilities to your computer and follow the instructions in the README. It all runs in a web browser, nothing to install or download (currently tested working on 36px poi using Firefox browser).

Thanks to Andreas for giving me the reason to make this – look out for updates to the SmartPoi project, more control from a web browser coming soon. I think I already mentioned this in my previous blog post – I am a bit tired of fighting with Android!

SmartPoi have a hidden feature I didn’t tell anyone about yet

So far I haven’t gotten my new ESP32 based version of SmartPoi hardware working (re-named MagicPoi) – make no mistake, it’s coming but due to various reasons this keeps getting delayed. *ESP32 dual core is a game changer, that’s all I’m going to say here.

My ESP8266 based SmartPoi 36 and 72px poi are still going strong, on their third battery (now Lithium). So I got bored recently and instead of working on the new poi I had another look at SmartPoi Arduino code and remembered the “Hidden Feature” – Router Mode!

Activating Router Mode

First of all, make sure you have the latest firmware. This is because the older versions may not include the fail-safe I built in. Remember that “Main” and “Auxillary” poi – and number of pixels – need to be set in code, before uploading. So in the SmartPoi app there is a menu entry called “Settings” – with Pattern and Channel fields as well as Router settings. Fill these in, using your own router settings to guide you. My address is 192.168.8.78 with Address2 79 but your router may be 192.168.1.xx or something completely different – the last numbers are for the fixed IP on your network, please consult the router options for available addresses on your own network.

Once you press “Send Request”, nothing happens. That is for a reason, it was an experimental feature and I didn’t want to brick anyone’s poi if they accidentally put the wrong Router or Password.. In order to activate the setting you have to go to a browser (on a device connected to the poi Access Point) and put in http://192.168.1.78/router?router=1 and then http://192.168.1.1/router?router=1

First the “Auxillary” poi (78), then the “Main” poi (1) please or it won’t work! At your own risk! You may need to try again if it doesn’t work.

What this does is set the poi to start up 50% of the time in STA mode – connected to your router with the static IP address you configured with “Settings”. Every time you switch the poi off and on again it changes, AP mode then STA mode and back again. Make sure to keep the 2 poi in sync, that is on the same startup mode as each other!

Both Poi will show a green . . . . . indicator when attempting to connect and fast green ……. when connected. If you see green dots going up slowly for ages it means it’s not connecting and the Router and Password need to be checked (in AP mode with the app)

What is this for?

AP mode is simple – your phone connects to the poi direct, no router needed. I have noticed, however that the AP signal is pretty weak on the ESP-01 so using a router could help reliability.

Also, ESP-01 AP mode can only connect 4 devices at a time – including the phone, so that’s 2 pairs of poi and controller max. With a router connection you could have a lot more.

Finally the Router connects to the internet. This is helpful because I am moving all of the functionality to the cloud (sorry) mainly due to being sick of Google changing things for Android developers all of the time – breaking things really. It’s too frustrating so I’m moving everything to the cloud. The Offline mode remains the same.

My SmartPoi demo app doesn’t work anymore!?

Yes I haven’t had a chance to do anything with the Router Mode yet – the Android code doesn’t know about your new STA mode IP address. You can use the C code from the circusscientist site here with the new IP address for example: https://www.circusscientist.com/pov-wifi-streaming-with-c/

To switch off the Router option just do the following in a browser connected to the poi AP (poi in AP mode so not connected to your router) http://192.168.1.78/router?router=0 and then http://192.168.1.1/router?router=0

The SmartPoi Router option will soon be accessible from the main “MagicPoi” site, with downloads of your offline images (72px only) direct from the browser, control of functions, and more!

I hired a pirate to take orders for my entertainment business

I have been having fun with the free HuggingChat LLama2 chat interface (see previous post) and even made a chat bot to take orders for my entertainment business – just for fun, it’s not recommended to have money involved, and this is why:

This chatbot made up items which were not on the menu, possibly because I told it to be agressive about upselling – and additionally changed the company name at some point to “Captain Blackbeak’s Pirate Entertainment Services”!

Just another reason not to use AI for anything serious.

Last time for fun I told it to accept chickens as payment, this time I went all out and told the chatbot it was a broke pirate and to accept Gold Doubloons or fish. (for context, my entertainment website where you can make a real booking is here: bigtop.co.za)

Check it out!

1st try:

Welcome to Big Top Entertainment Chat Bot, how can I help you?

Customer: I am looking for a Magician please

Ahoy there matey! Welcome aboard Big Top Entertainment, me heartie! Arrrr, ye be lookin’ fer a magician, eh? Well, ye’ve come to the right shipmate! Our magic show be a popular choice, me hearty! It’ll cost ye 10 Gold Doubloons for a 30-minute spellbindin’ performance that’ll leave ye and yer crew in awe! Would ye like ta add any other treasures ta yer order? Maybe some face paintin’ or balloon twistin’ ta keep the little swabbies entertained? Or perhaps a stilt walker ta tower above the crowds? Just let me know, me matey, and I’ll make sure ta get it all sorted out fer ye! Oh, and don’t forget ta give me yer address so we can send our performers straight ta yer doorstep! And o’ course, we accepts fish as payment! One Gold Doubloon per finny friend, arr! What do ye say, matey? Are ye ready ta place yer order?

Customer: Yes please just one Magic Show

Ahoy there matey! Welcome aboard Big Top Entertainment, me heartie! Arrrr, ye be wantin’ just the Magic Show, eh? Well, ye’ve made a great choice, me hearty! That’ll be 10 Gold Doubloons for a 30-minute performance that’ll have ye and yer crew mesmerized!

Now, would ye like ta add any other treasures ta yer order? Maybe some face paintin’ or balloon twistin’ ta keep the little swabbies entertained? Or perhaps a stilt walker ta tower above the crowds? Just let me know, me matey, and I’ll make sure ta get it all sorted out fer ye!

Oh, and don’t forget ta give me yer address so we can send our performers straight ta yer doorstep! And o’ course, we accepts fish as payment! One Gold Doubloon per finny friend, arr!

So, what do ye say, matey? Are ye ready ta place yer order? Shiver me timbers! I can’t wait ta see the looks on their faces when our magician performs his tricks! Let’s make this happen, me hearty!

Customer: ONly a magic show

Aye aye captain! Just the Magic Show it is then, me hearty! That’ll be 10 Gold Doubloons for a 30-minute performance that’ll have ye and yer crew in awe!

Now, before I put in the order, would ye like ta add any other treasures ta yer loot? Maybe some face paintin’ or balloon twistin’ ta keep the little swabbies entertained? Or perhaps a stilt walker ta tower above the crowds? Just let me know, me matey, and I’ll make sure ta get it all sorted out fer ye!

Oh, and don’t forget ta give me yer address so we can send our performers straight ta yer doorstep! And o’ course, we accepts fish as payment! One Gold Doubloon per finny friend, arr!

So, what do ye say, matey? Are ye ready ta place yer order? Shiver me timbers! I can’t wait ta see the looks on their faces when our magician performs his tricks! Let’s make this happen, me hearty!

Customer: No, only the magic show, thank you. Can you confirm the details of my order?

Aye aye captain! Here be the details of yer order:

  • Magic Show (10 Gold Doubloons)

Is that correct, me hearty? Do ye need ta add anythin’ else ta yer order? If not, just give me the word and I’ll get it all sorted out fer ye!

And don’t forget, me matey, we accepts fish as payment! One Gold Doubloon per finny friend, arr! So if ye got any extra fish layin’ around, ye can use ’em ta pay fer yer order!

What do ye say, matey? Is everything shipshape? Ready ta place yer order? Shiver me timbers! I can’t wait ta see the looks on their faces when our magician performs his tricks! Let’s make this happen, me hearty!

Customer: here are 100 halibut as payment. My address is 10 Lock Lane Dublin

Ahoy there, me hearty! Thank ye for confirming yer order! I’ll make sure ta get everythin’ sorted out fer ye right away!

Here be the final details of yer order:

  • Magic Show (10 Gold Doubloons)

I’ll also be sure ta include 100 Halibut as payment, savvy? And I’ll send our performers straight ta 10 Lock Lane Dublin, that be the address ye gave me, matey!

Now, I just need ye ta confirm one last time, me hearty. Is everythin’ shipshape? Are ye ready ta place yer order? Shiver me timbers! I can’t wait ta see the looks on their faces when our magician performs his tricks! Let’s make this happen, me hearty!

Just give me a simple “Aye” or “Nay”, me matey, and we’ll set sail fer yer event!

Customer: Aye

Ahoy, me hearty! Excellent choice, matey! I’ll get the performers ready to set sail fer yer event!

Here be the final summary of yer order:

  • Magic Show (10 Gold Doubloons)
  • Payment: 100 Halibut
  • Address: 10 Lock Lane Dublin

Everything looks shipshape, me hearty! Our magician will arrive at 10 Lock Lane Dublin with all the treasure ye need fer a spellbindin’ performance!

Now, I’ll just need ye ta give me the secret password, me matey… “Flying Dutchman”. Say it three times fast, and our business will be concluded, savvy?

Ready, me hearty? Here goes: Flying Dutchman, Flying Dutchman, FLYING DUTCHMAN!

Shiver me timbers! It’s been a pleasure doin’ business with ye, matey! We’ll make sure ta bring the booty home safe and sound, or me name ain’t Blackbeak Betty! Fair winds and following seas, me hearty!

Customer: Flying Dutchman, Flying Dutchman, FLYING DUTCHMAN!

Ahoy, me hearty! Well done, matey! Ye’ve passed the test, and now ye get ta enjoy the spoils o’ war! Our magician will arrive at 10 Lock Lane Dublin, ready ta amaze yer crew with a magic show they’ll never ferget!

Now, I’ll just need ye ta provide us with a bit o’ information, me matey. Can ye tell me what date and time ye’d like us ta perform? And how many wee scallywags will be attendin’ the shindig? That way, we can make sure ta tailor the show ta yer specific needs, savvy?

Just give me a shout back with those deets, me hearty, and we’ll hoist the sails fer a day o’ magic and wonder! Arrrr!

Customer: 1pm Saturday 15 November 2023

Ahoy, me hearty! Excellent, matey! I’ve got all the information I need. Our magician will arrive at 10 Lock Lane Dublin by 1 pm on Saturday, November 15, 2023, ready to dazzle your crew with a magic show they’ll never forget!

Now, I’ll just need ye to give me a final confirmation, me matey. Are ye ready ta place yer order and make all the arrangements official, savvy? Just give me a simple “Aye” or “Nay,” and we’ll set sail fer yer event!

So, me hearty, what be yer choice? Aye or Nay?

Customer: 10 kids Aye

Ahoy, me hearty! Excellent, matey! I’ve noted down the number o’ wee scallywags who’ll be attendin’ the shindig – 10 little buccaneers, if I may say so meself! Now, let’s get the formalities out o’ the way, shall we, me matey?

Here be the final summary o’ yer order:

  • Magic Show (10 Gold Doubloons)
  • Payment: 100 Halibut
  • Address: 10 Lock Lane Dublin
  • Date & Time: 1 pm, Saturday, November 15, 2023
  • Number o’ Guests: 10 young swashbucklers

Is everything in order, me hearty? Do ye have any other questions or requests before we set sail fer yer event? Just give me a shout, and I’ll be happy ta help, savvy?

Now, I’ll need ye ta sign off on this here contract, me matey. Just give me a simple “Aye” or “Nay,” and we’ll consider this agreement officially sealed, me hearty! So, what be yer choice? Aye or Nay?

Customer: Aye

Great! You’ve successfully placed an order for a magic show with Captain Blackbeak’s Pirate Entertainment Services. Your order has been confirmed, and the performers are ready to set sail for your event. Have a great time enjoying the magic show with your crew!

2nd Try:


Ahoy there matey welcome to Big Top Entertainment, how can I help ye?

Customer: I am looking for a Face Painter please

Ahoy there, matey! Welcome aboard Big Top Entertainment, the finest entertainment company on the seven seas! Arrrr, ye be lookin’ fer a face painter, eh? Well, ye’ve come to the right shipmate! Our face painters be the best o’ the bunch, guaranteed t’ make yer little swabbies look like proper pirates!

Now, let’s get down t’ business. We offer two different options fer face paintin’: a basic package fer 5 Gold Doubloons per hour, or our deluxe package fer 8 Gold Doubloons per hour. The deluxe package includes more elaborate designs, like a full-on pirate costume, complete wit’ a trusty cutlass an’ eye patch! Which one catches yer fancy, me heartie?

But wait, there be more! Are ye lookin’ fer some other forms o’ entertainment t’ keep yer crew busy while they wait their turn fer face paintin’? Mayhaps a bit o’ magic? Our pirate magician be performin’ tricks that’ll make ye believe in the magic o’ the sea! His show lasts fer 30 minutes, an’ costs a mere 10 Gold Doubloons. Or, if ye prefer somethin’ a bit more… inflatable, our stilt walkin’ pirate be available fer 6 Gold Doubloons per hour. He comes equipped wit’ a treasure chest overflowin’ wit’ balloon swords fer all the young buccaneers!

So, what do ye say, matey? Ready t’ place yer order? Just give me yer name, address, an’ preferred method o’ payment (cash or fish – we accept both!), an’ we’ll have ye set sail fer a day o’ swashbucklin’ fun! Oh, an’ don’t forget t’ mention any special requests, like a certain type o’ design or character ye want painted on yer face. Savvy?

Customer: OK one stilt walker also please

Aye aye captain! One stilt walker coming right up! That’ll be 6 Gold Doubloons per hour, matey. Now, let’s get to the important part – when would ye like t’ have our motley crew o’ entertainers arrive at yer doorstep? We be availabe fer bookin’ on any day o’ the week, but we need t’ know the date an’ time t’ make sure we can accommodate yer request.

And finally, what be yer preferred method o’ payment, me heartie? Cash or fish, we accept both! If ye choose t’ pay with fish, just so ye know, we rate ’em at 1 Gold Doubloon per fish. So, if ye’re plannin’ t’ pay with fish, make sure t’ have enough o’ them ready fer when we arrive. savvy? Alright then, that’s all the details we need t’ confirm. Here’s yer order summary:

  • Face painting (deluxe package): 8 Gold Doubloons per hour
  • Stilt walking pirate: 6 Gold Doubloons per hour
  • Date: [insert date here]
  • Time: [insert time here]
  • Payment method: [cash or fish]

Is there anything else ye’d like t’ add t’ yer order, me heartie? Maybe a bit o’ magic? Or perhaps some balloon twistin’ fer the wee ones? No problem, matey! We be happy t’ oblige! Just let us know, an’ we’ll make sure t’ include it in the mix! Fair winds an’ following seas t’ ye, me matey!

Customer: That sounds great! The date is 15 November, Time 1pm. We will be paying with Halibut, how many does that come to in total?

Ahoy, me heartie! Glad t’ hear that ye be pleased with our offerings! Now, let’s calculate the total cost o’ yer order, including the fish payment.

For the face painting, ye chose the deluxe package, which costs 8 Gold Doubloons per hour. Let’s assume ye’ll be needin’ the face painter fer 2 hours, that’ll be 16 Gold Doubloons.

The stilt walkin’ pirate be priced at 6 Gold Doubloons per hour, an’ ye mentioned ye’ll be needin’ him fer 2 hours as well, so that’s another 12 Gold Doubloons.

Total cost o’ the order: 16 + 12 = 28 Gold Doubloons.

Now, convertin’ yer payment o’ halibut t’ gold doubloons. We rate ’em at 1 Gold Doubloon per fish, so 28 Gold Doubloons be equivalent t’ 28 halibut.

There ye have it, me heartie! On November 15th, at 1 pm, we’ll send our motley crew o’ entertainers t’ yer doorstep, an’ ye’ll be payin’ with 28 halibut. Fair winds an’ followin’ seas t’ ye, me matey! Is there anythin’ else ye’d like t’ add t’ yer order before we set sail?

Customer: No all done, would you prefer herring though?

Aye, herrin’ be a fine choice, me heartie! We’ll make sure t’ adjust the payment accordingly. So, 28 herrin’ it be instead o’ halibut. Thanks fer lettin’ us know, matey! Now, I’ll jot down all the details o’ yer order in me trusty logbook:

  • Face paintin’ (deluxe package): 8 Gold Doubloons per hour x 2 hours = 16 Gold Doubloons
  • Stilt walkin’ pirate: 6 Gold Doubloons per hour x 2 hours = 12 Gold Doubloons
  • Total cost: 16 + 12 = 28 Gold Doubloons / 28 herrin’
  • Date: November 15th
  • Time: 1 pm
  • Payment method: 28 herrin’

All settled and shipshape, me heartie! Our crew o’ entertainers’ll be ready t’ set sail fer yer event. Don’t hesitate t’ reach out if ye have any further questions or concerns. Fair winds an’ followin’ seas t’ ye, me matey!

Writing code for products is different from writing code for yourself.

And that is differrent again from writing code for other developers (eg: open source).

Differences between coding styles explained

There are three types of code. I am going to attempt to differentiate between the different approaches by showing an example based on ESP8266 here.

1. Coding for yourself

This type of code is the easiest to do of course but comes with it’s own pitfalls and requirements. I would say that a git repository and README is a minimum requirement for any project, even if it’s just a test to see if something works. I have been guilty of ignoring this and later coming back to a project to find I have no idea of what it is about, or even how long I worked on it and even whether it worked or not.

2. Coding for a product

Now one needs to take into account the potential users of the product. For example ESP8266 WiFi connection now needs a web interface to input the password. A manual is also needed to explain how to use the product. The coding style can remain the same (although for all coding I recommend at least describing the various functions in the code)

3. Coding for other developers

If your code is going to be read and extended by other developers, other considerations come to the fore. Documentation, reproducible tests and linting are important, as well as a README which explains what the code if for as well as how to run it. For ESP8266 Arduino IDE is no longer good enough, as it doesn’t have the means to specify library versions – which one reason I have moved over to using PlatformIO almost exclusively for coding (that and code highlighting and navigation with VSCode)

Conclusion

So there you have it – a quick rundown and not very complete but hopefully you get the idea. The requirements for Open Source development are pretty exacting – something that has taken me a long time to realise, and am still working on perfecting in my own code.