Looking for IoT advice.

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

 

 I'm consider a a project that will use a browser interface over WiFi. I have

no experience with WiFi and IoT devices and it would help if someone could look

at the concept and let me know if this is reasonable.

 

 - I have chosen Espressifs ESP8266 as the client/server.

 - The device will only be accessible via WiFi, so it will

   need to connect directly to a smart phone/tablet in

   order to enter WiFi credentials and for local control.

 - From the browser I should only need to modify uploaded

   text and download it onto the device.

 

  Is this something that is done on a regular basis or

am I building something that is non-standard?

 

  I'm using an ATmega1280 to control the project, so I

think it would be difficult to take advantage of the Arduino

stuff. Having said that, can anyone recommend resources

that might help with this project?

 

  Any advice appreciated.

 

Regards,

 

A. 

 

 

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andrew99 wrote:
I'm using an ATmega1280 to control the project, so I think it would be difficult to take advantage of the Arduino stuff.

What is the attraction to the M1280 when the Ardunio Mega is cheap and available?    I do think you can find M1280 based arduino core so really not much of a barrier to using Arduino lib's.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

  Its kind of a trade off. I have about 5000 lines of code I need to port

to this new product. The current the device uses a keypad and LCD display.

 

 The existing code runs in about 1000 devices.

 

 I would need to learn the ins and outs of the Arduino, modify the

existing code and then add the web interface.

 

 Maybe I'm under the mistaken impression that developing the

web interface would be more straightforward?

 

A.

 

 

 

 

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andrew99 wrote:
The existing code runs in about 1000 devices.

 

that makes perfect sense now!

 

I work with "front end" guys who develop the web interfaces for our products, so I'm not much help there.

It seems to be another coding specialty from embedded C/C++ coding.  i.e. do you use php, angular, node, ... others I'm sure for the web interface.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not a Python or a C programmer, and I've not done much with IoT, however

 

SparkFun has a introduction to the ESP32 and MicroPython here.

 

While not exactly what you are looking for, it might be a good starting point to learn some basics, which you can then modify to meet your needs.

 

How complex is the current project, and how easily will you integrate WiFi access into the current project?

 

One might consider redoing the project using just an ESP... processor, which can easily handle the LCD, Keypad, and the IoT aspect, without the need for the second micro.

 

Do the 1000 devices in the wild already have the ESP... chip on the board?

If not, it sounds like this is a major rework on the project.

 

JC

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

  The current device is not connected to a network in any way. It

has a crude RS485 serial interface but lacks any networking

capability.

 

 I modified the existing controller card to to include a serial interface

connection and power for the ESP8266. ( Prototype. )

 

 I primarily deal with simple hardware design and programing and have

little to no knowledge of whats required here.

 

Regards,

 

 A.

 

 

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

    So you need to run a web server somewhere in the ESP or your Mega128. Only you can decide how much of this will run on the ESP and how much will run on the MEGA. Ideally would be as much as possible on ESP and as little as possible to the existing Mega code. The downside of this could be that you feel more comfortable to code for Mega than for ESP. You may find libraries for a bare TCP/IP stack to run on ESP and you build the web pages in the MEGA.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 'usual' solution would be to do the web stuff on the ESP as it has plenty of external flash to store your web pages. Then the interface with your other processor would be via serial. Depending on what actual data you need to transfer would determine how you packetise it via serial.

 

Also, note that you can do a whole lot of processing on the web browser - the javascript code is stored on the esp flash and loaded as part of the web page. So if you need to draw graphs or do curve fitting etc, do this on the browser.

 

At its simplest, the webserver is just a fileserver. The browser connects and expects a webpage which is just a file from the filesystem in the esp flash. It can also request more files. How do you transfer data between the webserver and the browser? AJAX is one method - effectively you request a file but in the webserver you have code that checks for specific filenames and gets the 'file' data from code that gets run. This code might send a request via serial to your other processor and when it responds, the 'file' data is returned to the browser. Similarly for writing data.

Other methods are to have special tags in your webpage code that the webserver looks for when it is serving a page when requested by the browser. When the special tag(s) is found, it is removed and the requested value is inserted. Downside is the webpage needs to be refreshed to update your data. This is the older skool method.

 

Then there's REST and websockets. Personally, AJAX is pretty simple.

 

There should be zillions of examples as this type of thing is what everyone wants to do.

 

I'd suggest using a ESP32 - later chip with more features.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andrew99 wrote:
It has a crude RS485 serial interface but lacks any networking capability.
A WebSocket can connect a MCU to an operator's web browser via a WebSocket server (MCU UART to/from WebSocket server to/from web browser)

Am aware of two proprietary WebSocket servers that can run on ESP8266 :

  • Minnow Server
  • Mongoose OS

There's an open source WebSocket server that runs on Linux, macOS, and Windows; might evaluate on an Intel Compute Card (12Vdc)

 


About HTML5 WebSocket - Powered by Kaazing

Introducing WebSockets: Bringing Sockets to the Web - HTML5 Rocks

websockets · PyPI (Python)

Embedded WebSocket Server (Minnow Server)

Mongoose OS - WebSocket client and server

https://github.com/chilipeppr/serial-port-json-server

Serial Port JSON Server is a websocket server for your serial devices. It compiles to a binary for Windows, Mac, Linux, Raspberry Pi, or BeagleBone Black that lets you communicate with your serial port from a web application. This enables web apps to be written that can communicate with your local serial device such as an Arduino, CNC controller… http://chilipeppr.com

...

[GPLv2]

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andrew99 wrote:
I'm using an ATmega1280 to control the project, so I think it would be difficult to take advantage of the Arduino stuff.
Arduino Uno WiFi rev2 is a mega4809 with Wi-Fi by an ESP32; its mega4809 source code was recently made visible.

Microchip's alternative is mega4808 to a Cortus APS3 (32-bit) with source code in ASF.

 

https://www.avrfreaks.net/forum/megaavr-0-series?page=2#comment-2579861

New IoT sensor node w/ M4808 + wifi + battery

ATWINC1500 - Wireless Modules - Wireless

...

A MCU host driver can be found in the Advanced Software Framework (ASF).

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
SparkFun has a introduction to the ESP32 and MicroPython here.
An alternative to MicroPython is Zerynth; it has some timing and sizing advantages.

Zerynth has a low price for each instance (it's not open) with sales from distributors or direct.

Zerynth has a cloud interface and can run on ESP8266 or ESP32; Pycom WiPy (ESP32) comes in a module form and Olimex has the ESP32 WROOM module.

DocJC wrote:
One might consider redoing the project using just an ESP ...
A network stack is typically non-deterministic; that might not matter for some applications.

ESP32 has a dual-core form so one core for the network stack.

GCC toolchain with a SDK from Espressif Systems.

 


Zerynth Supported Devices

Zerynth Distributor | Mouser

Webshop - Pycom (OEM)

ESP32-WROOM-32 (Olimex)

Espressif Systems Distributor | Mouser

https://platformio.org/platforms/espressif32/packages

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I'd suggest using a ESP32 - later chip with more features.
An ESP32 alternative is MIPS32 Wi-Fi modules; these run embedded Linux though consume about double the current at double the price.

Advantage is the wealth of FOSS packages.

 

Onion Omega2 Documentation - Connecting to Cloud Platforms

Onion

Powering the Omega with No Dock

https://docs.onion.io/omega2-docs/hardware-prep-no-dock.html

...

 

Providing Power

The Omega needs to be powered by 3.3V DC and requires 500mA to be safe. 

...

Omega2S & Omega2S+ System-On-Modules - Onion | Mouser

https://www.olimex.com/Products/OLinuXino/RT5350F/RT5350F-OLinuXino/resources/RTF5350F-OLinuXino-UM.pdf

(page 15)

3.4 Powering the board

[5V, 0.15A typical to 0.4A peak]

via Olimex - RT5350F

 

Edit: last URL

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Nov 1, 2018 - 07:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andrew99 wrote:
Maybe I'm under the mistaken impression that developing the web interface would be more straightforward?
There are terminal servers that connect a MCU or MPU's serial port to the LAN (serial port to TCP port)

Lantronix has device servers that can connect one or two UARTs to TCP ports; about three times the price of an ESP32 WROOM though no need to develop software for the module.

A Lantronix device server appears to have a MCU and an RTOS (ThreadX) which likely has the network stack.

Lantronix Global Device Manager is software for provisioning and operating a fleet of their device servers through Lantronix gateways; couldn't locate what operating system it runs on.

 

Wi-Fi Archives | Lantronix

Lantronix

xPico Wi-Fi – User Guide

(page 57)

9: Tunnel Settings

Serial tunneling allows serial devices to communicate over a network, without "being aware" of the devices which establish the network connection between them. Tunneling parameters are configured using the Tunnel menu and submenus in Web Manager as described in this chapter.

...

via https://www.lantronix.com/products/xpico-wi-fi/#docs-downloads

via https://www.lantronix.com/products/xpico-wi-fi/#tab-docs-downloads

 


Real-Time Operating System Royalty Free THREADX® RTOS

due to https://www.lantronix.com/wp-content/uploads/pdf/Embedded-Module-Matrix.pdf

 

edits: strikethrus, ThreadX

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Nov 3, 2018 - 02:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ATWINC1500 isn't a fit for this case as its interface is SPI.

Microchip's Roving Networks (RN) has Wi-Fi modules by UART but these are NRND.

Wi-Fi Network Controller | Microchip Technology

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another way to work a fleet of UARTs is by a value-added part of PlatformIO ... PIO RemoteTM

PlatformIO has ESP8266 so can create software to serve up a UART.

 

PIO Remote — PlatformIO 3.6.2a2 documentation - Use Cases

...

Remote Serial Monitor:

...

Plans and Features · PlatformIO

Espressif 8266 · Platforms · PlatformIO

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's an open source WebSocket server that runs on Linux, macOS, and Windows; might evaluate on an Intel Compute Card (12Vdc)

Another open source (LGPLv2.1) WebSocket server and client that runs on ESP32 down to mega328 and mega2560; includes ESP8266 :

GitHub - Links2004/arduinoWebSockets: arduinoWebSockets

https://github.com/Links2004/arduinoWebSockets#websocket-server-and-client-for-arduino-

a WebSocket Server and Client for Arduino based on RFC6455.

 

...

https://github.com/Links2004/arduinoWebSockets#supported-hardware

...

via Arduino WebSocket Server Using an ESP32 – Shawn Hymel

via Arduino WebSocket Server Using an ESP32 @HUZZAH32 Feather Board @arduino @shawnhymel « Adafruit Industries – Makers, hackers, artists, designers and engineers!

due to https://plus.google.com/u/0/+adafruit/posts/JNoUXgoUy2b

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you need to do it with a browser and webpage?

If all you want is remotely writing to the serial interface you already have, a simple telnet server on the ESP8266 could be enough.

On the PC, you can then log in with any telnet capable client. There are also telnet clients for smartphones, if necessary.

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lantronix XPico Wi-Fi doesn't have TLS.

XPico 240 has TLS plus a Lantronix gateway function, SDK, and e-mail.

 

A Wi-Fi module with limited TLS (TCP client only) and a UART interface is WIZnet WizFi310; in bulk, it's approximately 20% less expensive than a XPico Wi-Fi.

WizFi310 is on the WIZnet Arduino MEGA 2560.

 


xPico 200 Series | Lantronix

Home - xPico 200 Series SDK

products:wizfi310:wizfi310pg:start [Document Wiki]

Network Commands

...

 

AT+SCON

...

Opens a socket and if it is a TCP Client, establishes TCP connection with remote peer device.

...

* 'Secured' means TCP connection through SSL Encryption. It can be used in only TCP Client mode. 

...

WizFi310 | WIZnet Co., Ltd.

https://www.mouser.com/ProductDetail/WIZnet/WizFi310-PA?qs=sGAEpiMZZMsRr7brxAGoXSSUPDSAjAiVjW%252bis%2fvexGy1HfZWRNCwKw%3d%3d

osh:wizarduino_mega_wifi:start [Document Wiki]

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another apparently open source WebSocket server is

GitHub - ejeklint/ArduinoWebsocketServer

 

This library implements a Websocket server running on an Arduino. 

...

The implementation in this library has restrictions as the Arduino platform resources are very limited:

[text only, no fragmentation, no keep-alive]

...

 

Requirements:

https://github.com/ejeklint/ArduinoWebsocketServer#requirements

[Arduino IDE, Arduino Ethernet or shield, WebSocket client (a recent web browser)]

...

via https://github.com/u0078867/Arduino-Websocket-Fast

via https://github.com/Wiznet/WizFi310_arduino_library/blob/master/examples/WebSocketEcho/WebSocketEcho.ino

 


Arduino Ethernet Rev3 without PoE

Arduino Ethernet Library 2.0.0

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Minnow Server was dual-licensed (GPLv2, commercial) on 7-Dec'18.

wrt Microchip, the possible Minnow Server ports :

  • PIC32, MPLAB Harmony
  • SAMA5, Blackberry QNX or Microchip (Atmel) Software Package
  • other SAM, multiple RTOS or event frameworks
  • AVR and PIC, bare with lwIP
  • PIC24 and dsPIC (?)

 

PIC are 128KB max; so, 256KB for megaAVR and up to 384KB for XMEGA AVR are the better fit (128KB would be tight for app, SPA, Minnow Server, TCP/IP, TLS, Ethernet, scheduler, bootloader, FOTAU within app before boot)

Arduino's Ethernet library is for WIZnet Ethernet MAC (IIRC, max of 4 simultaneous sockets); Minnow Server reference is 1 socket max though is configurable.

Microchip's Ethernet library is for Microchip Ethernet MAC.

Dean's LUFA has RNDIS so IP over USB in-lieu of Ethernet.

 

PIC24, dsPIC :

Enough flash and RAM with some having for EBI PMP (100s KB of SRAM) and EPMP (MB of SRAM)

Probably lwIP for these though there are other IP stacks (Micrium TCP/IP, etc) (Microchip?)

 

PIC32MZ and SAMA5 have a MMU (GPLv2 Minnow Server can be separated from the application); otherwise, GPLv2 will be an issue that can be resolved by either purchasing a Minnow Server license or the application is FOSS compatible with GPLv2.

 

GitHub - RealTimeLogic/MinnowServer: A super small and fast embedded HTTP(S) WebSocket server

Efficient web server technology for resource-constrained microcontrollers | Embedded

by  (Founder & CTO of Real Time Logic)

JANUARY 17, 2019

...

 

(in second paragraph)

In fact, we believe WebSockets is the only viable option if you ever plan on TLS enabling the embedded web server.

...

 

Modern Web Application Reference Design for Microcontrollers

We recently committed our Embedded HTTP and WebSocket Server to GitHub. [MinnowServer on GitHub]

...

The HTTP protocol is used only for loading the SPA [Single Page Application]. In other words, HTTP is initially used by the browser when loading the application on demand from the device.

...

[signals, analog data, firmware over-the-air update (FOTAU)]

The complete SPA requires only 41 Kbytes of flash memory storage space.

...

The following screenshot shows the SPA firmware upload page.

...

All messages sent via the WebSocket connection are sent as JSON text messages except for the upload, which is sent as binary data. Modern JavaScript can easily manage binary data and the WebSocket protocol supports both binary and text frames.

[image of SPA's FOTAU]

 

Get Started with the Minnow Server

...

Note:

[immediately : Windows or Linux, quickly : ESP8266/FreeRTOS/lwIP]

...

The best way to think about how to create an SPA is to compare the development process to creating a desktop application or a phone application that is designed to communicate with a device using TCP.

...

[create an interface control document (information flows on WebSockets) to aid the firmware developer and the web developer]

...

 


MPLAB Harmony | Integrated Embedded Software Development Framework | Microchip Technology

QNX Operating Systems

GitHub - atmelcorp/atmel-software-package: Atmel Software Package

Arduino Ethernet Library 2.0.0

Four Walled Cubicle - LUFA (Formerly MyUSB)

lwIP: Overview

TCP/IP Networking | Micrium

https://www.micrium.com/downloadcenter/download-results/?searchterm=pa-microchip-pic243033&supported=true

yaSSL download | SourceForge.net

GitHub - ARMmbed/mbedtls: An open source, portable, easy to use, readable and flexible SSL library

 

edit: yaSSL, arm Mbed TLS

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Jan 25, 2019 - 06:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do not like the ESP8266 much, mainly because there is no decent datasheet available, but just some 30 page overview.

"arduino" works on ESP8266 though, and the "Wemos D1 Mini" are nice small & cheap boards to work with.

 

I do not see much advantage in "Zerynth".  As most of the ESP8266 boards have multiple MB of memory the smaller footsize of Zerynth also seems mostly irrelevant.

I would also rather donate to Open Source projects I like than pay in advance for stuf I'm not even sure of whether it does what I want. It is the way my brain is wired.

If you like support from the manufacturer, then Zerynth may have the advantage for you.

 

Micro Python does indeed seem to be a nice option to write software for the ESP8266:

http://docs.micropython.org/en/latest/esp8266/quickref.html#dht-driver

 

Developing web related stuff is probably best done on a PC. Whether wired or WiFi, most of it is simply TCP/IP and having a keyboard and monitor on your target is a big convenience while developing software.

 

There are also multiple libraries available for web server like behaviour in Python. (but also in other languages).

With flask, for example this is the code for a working web server:

from flask import Flask
app = Flask(__name__)
 
@app.route("/")
def hello():
return "Hello World!"
 
if __name__ == "__main__":
app.run()

Source:

https://pythonspot.com/flask-hello-world/

I have not checked if Flask or any of the other web libraries have been ported to ESP8266.

 

Another technology that could be very relevant to your situation is MQTT.

MQTT is a standarized and lightweight protocol for machine to machine communication to exchange sensor data and more.

I never used it myself, but this should get you going:

https://duckduckgo.com/html?q=esp8266+mqtt

https://en.wikipedia.org/wiki/MQTT

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sun. Jan 27, 2019 - 04:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller