Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 14:34 29 Mar 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic and WiFi (eg via ESP8266)

Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 839
Posted: 01:41am 27 Sep 2020
Copy link to clipboard 
Print this post

Hello all,
The latest Silicon Chip article "Mini WiFi LCD BackPack" describes an ESP8266 WiFi module connected to a "Micromite BackPack display" and an Arduino programmed module. This should be able to access the www and control devices etc.
This prompts me to ask, is this possible using an MMBasic-based system (including CMM2 or others)?

There has been discussion on TBS, eg here but, as far as I understand, this used Python etc, whereas I'm looking at straight MMBasic and, if necessary Windows 10 tools.

Cheers,

Andrew
(I'm also interested in SC's use of the term "Micromite BackPack display" - is this good publicity or not?)
Edited 2020-09-27 11:43 by Andrew_G
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 02:43am 27 Sep 2020
Copy link to clipboard 
Print this post

MatherP's armmite H7 backpack has an esp-01, and I believe he and others have threads about connecting other micromites.

I think in the link you referred to python is what the poster used on his PC to talk to the CMM2 ESP-01--you could use pretty much any language you wanted to do the serial communications.

Stock ESP-01 comes with an "AT" command mode which you can use to send TCP messages from a mite. The ESP-Link software for the ESP-01 provides additional capabilities.
Edited 2020-09-27 12:47 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 03:06am 27 Sep 2020
Copy link to clipboard 
Print this post

Andrew,

It is certainly possible. I have loaded Annex Basic into an ESP8266 and run a program on a Maximite Plus.

The Maximite+ monitors a number of switches and controls relays in a camper trailer. It connects to the ESP8266 via serial and the Annex basic program in the ESP8266 'remotes' the switches. These can then be operated by my smartphone using wifi.



sw_9.zip

The image above is a sample of the MM+ display (which is hidden in an outside accessible panel      ) - I use the 8266 to remote the controls inside the camper trailer so I can controls things from bed using my phone!.

sw_9.zip includes the Annex Basic code for the 8266. Annex Basic is pretty easy to use as it is very similar to MMBasic. To link the two, you just need to determine a data exchange protocol (mine is very simplistic) and run it over a serial link.

There are other similar projects I think in FruitOfTheShed.

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1983
Posted: 07:08am 27 Sep 2020
Copy link to clipboard 
Print this post

the 8266 is getting a bit "old" now and there are probably better modules but they will still provide what you want and they are cheap as dirt, and more importantly, they just "work"

here  is the guts of my 8266 based server. It is not a trememndous amount of code; under 8k with comments and general support functions useful elsewhere. The code is a bit shonky by my standards today - I was still fairly new to MicroMites in 2016 - but it does what it says on the tin.

It is multi-channel and handles the simultaneous connection for 5 (or is it 6?) inbound HTTP channels. You have to parse the actual page responses yourself (this is the meat of your API) but it will do all the tedious mucking about of the headers etc and you can clearly see where to insert your own stuff.

There are also a *lot* of links that I used when i was getting this working. Can't claim to them still being up, but they helped me when I was writing the code they might help you too.

This was a section of my GSM gateway (web to text message + handling of inbound text messages) - that is on FotS also if you need to see it used in anger.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 11:41am 27 Sep 2020
Copy link to clipboard 
Print this post

  panky said   . . . I have loaded Annex Basic into an ESP8266 and run a program on a Maximite Plus.

Doug--nice screen and thanks for the html upload. Would you be willing to also post your Annex code and especially your MM+ code?

It looks like it would be full of useful bits for my house monitoring project with battery backup for power outages. It might make me finally decide on the right device to host the controller (picaxe, micromite, ESP32).
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 05:31am 28 Sep 2020
Copy link to clipboard 
Print this post

@lizby,

As requested.

Annex Basic file

sw_9.zip

MMBasic program

camper.zip

Web interface created by ANNex Basic



MMBasic lcd display (updated from previous but SAVE IMAGE decided not
to work for me so quality is ordinary).




The MMBasic program is running on a custom MM+ board that has relays and current sensors. Display is a 5" LCD. The Annex Basic is running on a WiMOS D1. The 2 are linked via COM1.
Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 11:41am 28 Sep 2020
Copy link to clipboard 
Print this post

Doug--thanks very much. Great stuff--really fine-looking screens.

But I think the Annex Basic file sw_9.zip contains the same html file you posted originally, not the Annex Basic. I do like the Wemos D1 Mini board.

Lance
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
JoOngle
Regular Member

Joined: 25/07/2020
Location: Sweden
Posts: 82
Posted: 03:07pm 28 Sep 2020
Copy link to clipboard 
Print this post

  CaptainBoing said  the 8266 is getting a bit "old" now and there are probably better modules but they will still provide what you want and they are cheap as dirt, and more importantly, they just "work"


Not sure, I've got tons of 8266's (all variants even), but they seem to suffer from a "latchup" after running for some time, and require some resetting.

As for modern equivalents, I can wholeheartedly recommend the new ESP 32, superfast, better security, more memory space etc.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 12:27am 29 Sep 2020
Copy link to clipboard 
Print this post

@lizby
  Quote  But I think the Annex Basic file sw_9.zip contains the same html file you posted originally, not the Annex Basic.

My bad mate - correct file is
sw_22rc2.zip

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 12:51am 29 Sep 2020
Copy link to clipboard 
Print this post

Thanks again. Really fine piece of work, and just the kind of information I'll be looking to gather and display.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 839
Posted: 06:10am 29 Sep 2020
Copy link to clipboard 
Print this post

G'day folks.
Many thanks for your links, comments and code (I'm still reading - and will be for a while yet).
Doug - you have answered my main question - that "YES" it is possible.
I've ordered the Silicon Chip kit to see if I can at least get that working.

My next step might be to communicate with it via a MM+ or MM170 from my HC-12 network (weather and temperature data) and display it on a 3.5" LCD (or a CMM2 on my 10" VGA) - it will definitely be small steps.
I am keen to see if I can develop a basic home automation project for our new home (still in the design phase - again)

Can you bear with me while I try to re-state your explanation:
- the 8266 has the Annex Basic code loaded on to it (how?)
- the 8266 handles the WiFi and gets data from the MM+ via serial (hardwired?)
- the MM+ interfaces to the devices (various pins and analogue/digital etc)
- the MM+ manages the GUI and local touch controls
- your phone (or anything on your network) communicates with the 8266 via WiFi.
- the HTML script sets up the buttons on the phone - (What type of phone and how do you program it?? - I have iPhone, iPad etc.).

Thanks again,

Andrew
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1983
Posted: 08:02am 29 Sep 2020
Copy link to clipboard 
Print this post

  JoOngle said  
Not sure, I've got tons of 8266's (all variants even), but they seem to suffer from a "latchup" after running for some time, and require some resetting.
.


honestly not had a problem. this system has an uptime of 1.3 years(!) until I had to tweak the code and it started again. MM2 5.0408, ESP8266+M590 GSM module

 
JoOngle
Regular Member

Joined: 25/07/2020
Location: Sweden
Posts: 82
Posted: 03:10pm 29 Sep 2020
Copy link to clipboard 
Print this post

  CaptainBoing said  
honestly not had a problem. this system has an uptime of 1.3 years(!) until I had to tweak the code and it started again. MM2 5.0408, ESP8266+M590 GSM module



I'll take your word for it, maybe a bad batch for me?

Funny you also have the same m590 GSM module as me, I have quite a few of those too, maybe we peruse the same forums  
Edited 2020-09-30 01:11 by JoOngle
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1983
Posted: 04:53pm 29 Sep 2020
Copy link to clipboard 
Print this post

  JoOngle said  

I'll take your word for it, maybe a bad batch for me?

Funny you also have the same m590 GSM module as me, I have quite a few of those too, maybe we peruse the same forums  


As far as the M590 goes, I haven't seen much using it... always seems to be the 800 and 900 GSM modules. The 590 was easy enough to work with - once I had tweaked the module to provide a proper Vcc (and not using the diode drop from 5V - expressly disapproved in the PDF) and brought out the reset line to the connector instead of the soft on/off toggle - you could never tell where the thing was in its power cycle. you could "reset" it only to find you had turned it off and then get hopelessly lost.

For me I built a beastie that was two fold. Primarily had a power plug that was under control of a MM to cycle the power on my router - at the time it had a habit of hanging and needed a cold start to fix... invariably while I was away. I could do so by sending a text message to the box. It also worked as a text gateway from a web-api I could send text messages from the M590 and process inbound text to IP. It worked really well but my latest fibre router has better firmware and the hangs are a thing of the past - I reset the thing from Madeira once   got a text saying it couldn't ping the router on the other side of the fibre (in my ISPs PoP), I send the reset command via text, it texts me back saying all done, I check that I can hit the API - all good. Documented the whole thing here

I love automating my life.
Edited 2020-09-30 02:57 by CaptainBoing
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 11:43pm 29 Sep 2020
Copy link to clipboard 
Print this post

  Andrew_G said  
Can you bear with me while I try to re-state your explanation:
1.  the 8266 has the Annex Basic code loaded on to it (how?)
2.  the 8266 handles the WiFi and gets data from the MM+ via serial (hardwired?)
3.  the MM+ interfaces to the devices (various pins and analogue/digital etc)
4.  the MM+ manages the GUI and local touch controls
5.  your phone (or anything on your network) communicates with the 8266 via WiFi.
6.  the HTML script sets up the buttons on the phone - (What type of phone and how do    you program it?? - I have iPhone, iPad etc.).

Thanks again,

Andrew


Andrew, taking your questions in turn,

1. To learn about Annex Basic, go to here for all the info on loading Annex Basic and how it all works. There is also a serial flasher as part of the BASIC toolkit to flash the ESP chips.

2. The serial link between the 8266 and the MM is direct hardwire (they are in the same box).

3. Yes.

4. Yes.

5. Yes. There are a couple of different ways to connect to the 8266 - you can set it up to be part of your own sub net and access it via your router or you can connect directly to it's own sub net (it appears as a WiFi network ESP86: followed by its MAC address. It defaults to an IP address of 192.168.4.1)

6. The HTML scripts in the 8266 act as a web server - they are accessed by any browser, doesn't matter what platform. There is no additional code or apps needed on the device you access the 8266 via WiFi. That is, it can be phone ,tablet, PC, MAC etc. The 8266 has embedded Javascript code to link the HTML that your browser is acting on with Annex BASIC in the 8266. This in turn interacts with the serially connected MM.

A couple of further notes/caveats:

- the Annex BASIC web interface does not like Chrome as the browser - in the edit mode it gets lost from time to time as to which line you are editing. Firefox works fine.

- you will need to have a reasonable knowledge of HTML and CSS to understand what is happening re the switches - see here for a full description as well as learning examples ( it took me some months to fully??? understand how the 2 interact with Annex BASIC).

Lastly, Annex BASIC is for PRIVATE USE ONLY according to the creator. You can not use it in any commercial products. It's a nice system and the site mentioned above is extensive.

Enjoy the journey  
Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 839
Posted: 03:34am 30 Sep 2020
Copy link to clipboard 
Print this post

Thanks Doug,
Great advice and the links look very good. You make it seem so do-able - time will tell.
(I have no problem complying with private use and giving attribution etc.)

CaptainB - your postings on FruitOfTheShed are fantastic too. I scanned them for the third time last night and will keep re-reading until I understand more than the 1% I do now.

Regards,

Andrew
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1983
Posted: 09:21am 30 Sep 2020
Copy link to clipboard 
Print this post

  Andrew_G said  Thanks Doug,
Great advice and the links look very good. You make it seem so do-able - time will tell.
(I have no problem complying with private use and giving attribution etc.)

CaptainB - your postings on FruitOfTheShed are fantastic too. I scanned them for the third time last night and will keep re-reading until I understand more than the 1% I do now.


you are most welcome. I cringe a bit when I look at the code in places... I've come a long way in MMBasic in the past 4 years    
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 09:38am 30 Sep 2020
Copy link to clipboard 
Print this post

I really liked your caravan camper interface, great!, I have to agree the combination of Annex with the Micromate hardware is really worthwhile I believe. I have posted previously a camera trigger where this exact combination was used. Sometimes the code involved to make a user interface can be a larger effort than the actual code for the project.

Following on from the Camera Trigger here I have been working on some code for both the Annex and micromite as a template that could be used in any MM hardware project. The Annex RDS firmware brings several communication features to the uMite, especially for the mm170 where it enables a usable file storage ability. I have enabled the latest code i have at this location if anyone wants a look.combo

Mike
Codenquilts
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1983
Posted: 08:43am 01 Oct 2020
Copy link to clipboard 
Print this post

  MikeO said  Sometimes the code involved to make a user interface can be a larger effort than the actual code for the project.


So true. I built a heated bed controller for my 3D printer - it spent months running as a "terminal application" because I just couldn't face the aggro of a custom screen. It took me a month of pondering to come up with this  



.. but I am fairly happy with it. It's moved into a daily user state so... a few wrinkles but mainly with the underlying operation. Provides all the functionality I need in an almost "finger operable" touch display.

I always aim for that Windows95/CE look. I have developed a few routines that make it easy(er) but I plan to do a grid based system when I get time, which should make it all really easy (the code to parse the touches and equate to a button is a pain).
Edited 2020-10-01 19:09 by CaptainBoing
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 839
Posted: 01:47am 02 Oct 2020
Copy link to clipboard 
Print this post

Hello all,
As I mentioned above I ordered one of the ESP8266 kits from Silicon Chip and it arrived yesterday.
Unfortunately the PCB had an issue. I emailed the general contact address and VERY quickly got a personal reply from Nicholas Vinen, the Editor.
He was most gracious, has ordered me a replacement PCB, and has/is contacting others who may have the board.

Very good customer service!

It will delay my project a little but far better that the problem was identified and rectified before I had assembled everything.

Cheers,

Andrew
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024