Introduction

CiccioCB's Annex Wi-Fi BASIC is a BASIC interpreter designed to run on the ESP-8266 family of wifi 'System On a Chip' (SOC) devices.
The ESP-8266 family of devices are smaller than an arduino, but run faster and have more available program memory, plus have integrated wifi.
Real-time wifi editing of interpreted BASIC is much quicker and easier than recompiling and uploading every slight edit using arduino environment.
No compiling is needed, you could Copy and Paste an entire new BASIC program then Save and Run it quicker than you can read this sentence.
The BASIC programming language is one of the easiest to learn and use because it is based on human-readable English language.
Don't let names fool you though, because BASIC does not mean simplistic, and this version of 'basic' from Ciccio (pronounced "Chitch" "eee" "ohh") is much more than just a Basic interpreter... it is a complete integrated BASIC development 'system', with amazing features and capabilities.

Includes: Full feature set available to both 1Mb and 4Mb devices. Separated Firmware and SPIFFS management, allows firmware updates without data loss, and zip data backups and restores. Integral SPIFFS repair facility (never loses files to corruption). IMMEDIATE window to execute specified instructions and evaluate expressions even when the script is not running. Script COMMAND instruction able to evaluate anything similar to Immediate window. F2 invokes context-sensitive Online Help of Basic keyword at flashing cursor in Editor. Full Error control.
Too many other excellent features to mention + more software instructions than you will know what to do with + all sorts of hardware devices.



System Components

   Firmware
The essential heart of the system is the Annex Wi-Fi interpreter firmware, which is a 'binary' file that runs on the ESP device processor.

   User Script
An ascii text file containing a list of 'human-readable' instructions which Annex Wi-Fi interprets and acts on as it parses through it.
 
   Hardware
The firmware runs on 'portable' ESP-8266 wifi devices which can be considered as remote 'Satellites' - there may be many, in different locations.
(See some ESP modules and hardware tips further down this page)

   Wifi Browser
Communications with the remote ESP satellites devices is done via wifi (radio) using a web browser on computer or smart-phone etc.

   Computer Serial Port
Launching (flashing) of the ESP satellites is by a computer-based 'ground-control' program called AnnexToolKit.exe which uses a Serial Flasher 'umbilical cord' to upload the binary firmware image to the ESP device.

   Computer Software
In addition to a Serial Flasher, the Annex ToolKit utility contains a Serial Monitor console, a UDP (network) Control console, a Backup and Restore facility, an HTML Converter utility, an OTA (Over The Air) Update Server, and a File Manager utility for Upload and Download of files between computer and ESP device(s) - the usage of all features will be explained in due course.

   Communications
After an ESP satellite has been 'launched' (flashed) by serial port, it 'serves up' some in-built web pages which allow it to be connected to remotely by browser over wifi. The served pages provide a remote script editor and debugger, plus remote OTA firmware updates, thus making the comprehensive 'ground-control' computer support 'tool' and serial 'umbilical cord' no longer essential for continued operation.

Web-browser connection to the remote ESP satellite modules can be done using any terminal with wifi browser capability, ie: desktop computer, laptop, tablet, smart phone, etc... and appropriate Internet access can (if wished) offer connection from anywhere in the world.

Alternatively, Annex WI-Fi Basic devices can be configured to auto-run a script at power-on to provide isolated autonomous operation.

   Memory
Annex WI-Fi Basic runs on any of the ESP-8266 family of wifi devices which have 1Mb or more of memory (cannot be used on 512Kb devices).
The firmware fits into 1Mb of device memory space while leaving sufficient memory remaining for the required SPIFFS file system to hold data.
The SPIFFS filing system permits storing files on available device 'flash' memory - but note that it has some restrictions:
    31 maximum filename characters - including folder names and '/' '.' separators.
    Case-sensitive, eg: /program/file.bas is a different file to /Program/file.bas or /program/File.bas or /program/file.BAS etc.
    Dynamic file allocations to optimise flash memory usage (flash cells have a max number of writes limitation before memory failure).

Devices with more than 1Mb memory have the same size firmware file, but can have larger SPIFFS for increased file storage.
During flashing, Annex WI-Fi Basic will auto-size its empty SPIFFS according to available device memory (currently from 1Mb to 4Mb).
When uploading files using the File Manager, the SPIFFS filing system allocates them into memory according to a dynamic algorithm.

A binary backup of the firmware and/or SPIFFS data is a 'snapshot' of configured dynamic flash memory, thus making it size-dependent.
IMPORTANT NOTE: Because of the size-dependent memory allocations, binary backup images give potential for 2 problem scenarios:
   1. Restoring a binary image from a larger memory device onto a device with less memory will cause SPIFFS corruption.
   2. Restoring a binary image from a smaller device onto a device with more memory will not allow the additional memory to be used.

Uploading individual files (or groups of files) using the SPIFFS file system allows it to dynamically allocate them according to available memory.
It also permits copying just those required files, rather than the full SPIFFS image size even if empty of contents.

The Annex Toolkit File Manager tool now includes ability to upload selected files from zip, and similarly to download selected files to a chosen zip.
This offers ability to load and save projects to specific project zips, ideal for sharing projects, or as transparent browsable backups.
 
 
   My Preferred ESP modules
This is not intended as a comprehensive hardware device review,
just a mention of some of the hardware I find useful, and why.

Top of my list is the Serial Dev Kit ESP-202 module - thankfully I bought several while they were plentiful, because they are now harder to find.
Some of the useful features are:

On/Off switch ... sounds obvious, but I don't know of any others with one.
Easily accessible GPIO0 jumper ... offering push-on switch replacement.
RGB LED
connected to gpio's 12, 15, 13.
Onboard status LEDs for gpio's 16, 14, 2, 0, 4, 5 and power.
The RGB LED and onboard status LEDs allow easy monitoring of gpio pins without requiring external LEDS and limiting resistors.
Top-mounted breakout pins.
On-board USB UART
... my normal method of powering the module, even when portable from a USB solar power bank.
Onboard switchable ESP-01 socket ... allows plugging in ESP-01's for testing, programming, flashing.
Battery box supplied ... but instead of soldering it directly to the module, I solder pins to the module and connect dupont female sockets to the box.


This allows the battery box to be plugged on if needed, or to plug on a rechargeable Lipo instead, or it gives
a 5v pin available from the USB to power external 5v devices.

NOTE: Even though the ESP8266 is a 3.3v device its pins are 5v tolerant and I regularly power 5v modules from the 5v battery pin and connect the modules 5v logic output directly to an ESP pin, always without problems.
All usable ESP pins are broken out, offering 5v & 3.3v pins plus 3 GNDs
Replacing the gpio0 jumper with a plug-on momentary pushbutton makes it more convenient for one-handed operation with the On/Off switch to boot up the device into flashing mode.
It also offers a handy method for quickly plugging on different switches and sensors for trying with projects.

 
Second favourite is a "Next Evo" produced by TrackerJ,
It has the autoflash feature similar to NodeMCU but it is slimmer and therefore more breadboard friendly.
Plus the pin holes are left vacant, so it can be fitted with long pin header sockets if wished.
Some carefully applied strength can widen the long pins sufficient to fit Wemos D1 Mini shield footprint.
But... what makes this module really useful for me, is the provision for fitting an i2c header socket.
Look at the bottom one shown in the picture and you can see a PCF8591 AD/DA module plugged in and standing up vertically - giving 4 analog inputs (connected to a trimpot, LDR & thermistor) plus a digital to analog converter... and all without any wires. This offers the easiest way for i2c development that I know of.

I bought a couple via email, and when I mentioned the difficulty of finding or ordering them online TrackerJ said that his sales are normally from 'walk-in' customers... so I don't know if they will be available online.


Another useful dev 'special' is a single-inline module bought from a Greek ebay seller a couple of years ago.
It plugs upright into a breadboard, giving a very narrow footprint, allowing more room for other components.
You can see one resting on the breadboard, and another plugged in above it with components on either side.

All the normal pins are available in a single row for plugging into a breadboard or female header socket.
The UART connections are separate and opposite.

The guy making them was also advertising them elsewhere, so they may still show up in an online search.


I'm not a fan of the relatively chunky NodeMCU, but the version with integral OLED offers a handy self-contained on-screen display for output.

The Wemos D1 Mini is the NodeMCU baby brother with a more practical footprint and offering a range of plug-on shields, even an OLED display.
Of particular note is the dual (and triple) base adapter which allows plugging in additional shields... because it also offers great potential for using 2 devices side by side - perhaps as a serial bridge between Annex and Arduino, or to bridge an isolated secure subnet to an internet subnet. 


A nice feature of NodeMCU and Wemos devices is their easy 'autoflash' capability which avoids having to ground gpio0 during reset for flashing.
In practice that's not so important because even 1M Annex WI-Fi Basic devices only need flashing the first time, then can be updated by OTA.
Just remember than an OTA flash is not an update, it is a new firmware flash which will overwrite existing data. so take a zip data backup first.
 



Of the other ESP modules I've tried, most don't get used much because they don't offer a useful advantage.  

But perhaps special mention should go to the Wemos D1 arduino look-alike, for its familiar footprint.

Handy for use with arduino prototshields etc, and of course LEDs and jumper wires can plug straight in.

Can be powered by USB, and has simple 'autoflash' facility, so offers a useful experimenting platform.


What I DO use a lot of - and deserves special mention - is the wide range of Sonoff/Itead ESP-based products, which are convenient, practical, affordable... and in most cases, usable as-is. If you need to control something using a relay, there is a neat ready-made Sonoff that could do it.



   Hardware Tips
You'll probably want a breadboard - and be aware that if the thin red and blue lines don't run unbroken full length it is because they are denoting a track break, so applying power to one end of the breadboard won't power the other end unless the supply rail gaps are bridged with jumpers.

You'll probably get a pack of assorted length male2male jumper cables, but you may also want 30cm male2male, male2female, female2female.
I cut up and join some jumper wires to make a variety of male/female dupont "Y" adapters to allow more than 1 connection to a single pin or skt.
I also do something similar with a couple of 4.7K resistors to make a 3-legged i2c pullup assembly with a common +V connection.
Typical 'tactile' momentary push-buttons have a tendency to pop out of breadboards, so I usually connect to a multi-switch module (not a matrix).
While your soldering iron is hot...LEDs are quicker and more convenient to use with an appropriate current limiting resistor already attached.
(use an LDR instead of a resistor to give automatic brightness level adjustment)



I have some breadboard-friendly 6 LED modules (can't understand why they didn't do 8 LEDs) with integral 1K limiting resistors.
But it is worth pointing out that if for instance I wished to display individual switch status leds for all inputs of an 8 port expander it would either require 8 gpio outputs to have one for each of the leds, or require a second 8 port expander configured specifically as outputs for the leds.

A more practical alternative could be to use a single gpio pin to address as many neo-pixels as I could realistically need (potentially hundreds).

I plan to do a chapter on neo-pixels later, but suffice to say now that a neo-pixel is basically a clever RGB LED plus driver chip with a digital input, plus a digital output for optionally feeding into a following neo-pixel.
Each neo-pixel takes the 'address' of its position in the chain, and each is capable of being controlled independently by sending an RGB colour code to its address (or all the chain can be addressed at once).

Neo-pixels are available as single pixels, or in a hard stick of 8, or rings of 8, 12, 16, 24 etc, or wired into strings, or as flexible 'tapes' of 1m or more, or 8x8 or 16x32 matrix grids etc... and the digital output of any neo-pixel can be chained into the digital input of any other, irrespective of their styles.
Each and every neo-pixel is individually addressable, and their RGB colour values are all individually controllable between 0 (off) to 255 (full on).
So in the case of the example 8 switch port expander, an 8 neo stick could allow displaying the status of all ports in any chosen colours... using 1 gpio.
  

Breadboard power supplies have a USB power input, as do all the ESP devices with onboard USB UARTS, and various other types of modules.

But you'll probably want to reserve your computer USB port for flashing and serial data, so you may want to buy a few cheap USB chargers - you can buy household mains and car lighter versions for less than a quid.


A USB power bank can be a handy device for powering mobile projects on-the-go.

Some have solar panels for charging during the daytime without needing a mains supply.
Housing one inside an inverted transparent plastic kitchen box with water-tight clip-on lid
is handy for powering external projects such as an ESP with radar detector for instance.

Search for Solar Power Bank and you should find some for less than £4 (free postage).




   Buying Tips
All these sorts of items are available off ebay with free delivery on a slow boat from China for less than it costs to drive to your local supermarket.
If you select "Buy it now" Format then wait for screen refresh, then select "Worldwide" Item Location and wait for refresh, then tick "Free postage" Delivery Option, you will be presented with new items available for sale to other countries at perhaps better exchange rates still with free delivery.
if you enter .99 for example into the Price "to" window then click the ">>" button it will only list any items costing less than a quid.

If a cheap free delivery item is available for about the same price from several sellers, and is cheap enough that I decide to get more than one of them, I have learned not to put all my eggs in the same basket by ordering multiple items from the same seller... if it is free delivery then it doesn't cost me any more to order only 1 from several different sellers, then if there is a problem with any one item, it won't affect any of the others.

Similarly I have learned not to order many items at a time from a seller - it doesn't benefit me if a seller bundles many free delivery items into one bigger package, but it will be worse for me if there is a problem with a bigger package of many items, so I spread them out to be sent individually.

Be aware that there is a growing number of cheating scammers who deliberately undercut prices to grab the cash flow without any intention to supply. You could be waiting several weeks for a delivery that never comes, then eventually be forced to seek re-imbursement from ebay.
But you can usually spot such scammers simply by looking at their total transactions... I would rather pay the going rate to a seller with a rating of tens of thousands rather than risk being conned by a deliberate scammer with a rating of less than 2000 because of trying to save a few pennies.
So if you've had good dealings with a seller, go back to him knowing he's genuine, rather than risk penny-pinching to slightly cheaper unknowns.

Occasionally some items don't work, occasionally some don't arrive, but the paypal money back guarantee means you never need to lose out.
Most ebay sellers are very protective of their feedback reputation, so will attempt to keep you satisfied without you needing to complain to ebay.
If you do need to escalate a problem to ebay you have a realistic expectation of receiving satisfaction, which is more than you may get elsewhere.

Ali express does not impose an 'honesty' feedback system on their sellers, and has more financial incentive to favour their sellers rather than the victims, therefore dishonest sellers with no reputation to protect and little fear of reprisal can (and some do) openly lie and cheat to 'rip off' buyers knowing there is nothing their victims can do about it. So don't be tempted by prices that are too good to be true, because they may cost you dear.

Wherever you buy from, any ripoff scammer who is deliberately baiting a honey trap can obviously under-cut the best prices of all genuine sellers.

But when all is said and done, it is astonishing what cheap hi-tech devices and modules we can buy sent free delivery from around the world.