On the console tab, click on “Connect (Web Bluetooth)”
And you will get the Bluetooth REPL terminal using BIPES to your ESP32 generic board!
Thank you very much makerdiary. I based the Web Bluetooth code on his project, which can also be directly used from the Web to access the ESP32 Web Bluetooth REPL:
A system installed outdoors using an Arduino Mega + Ethernet shield to send DHT11 and other sensor data to a remote server
Completed continuous 2 year operation on July 12 2021
Server uses Linux+PHP+MySQL
1826506 records on the database
Highcharts used to plot graph with data
Average time to query MySQL table with 1.8 Millions records takes about 1 second. Server is a virtual machine at 2GHz with 4GB RAM / standard virtual hard disk. Table has only the primary key, without additional indexes
This post describes how to load MicroPython on ESP32-CAM module, without using esptool – just using a web browser, and then using the ESP32 camera with MicroPython.
You can use ESP32-CAM module with the esp-32-cam-mb board, allowing direct connection from ESP32-CAM to a PC using USB cable. If you don’t have a esp-32-cam-mb module, you can connect ESP32-CAM module to a PC using a USB-Serial converter, such as the setup shown on the image below:
Many people, specially beginners, report trouble installing and using esptool to flash ESP32 boards. Thanks to Adafruit (https://github.com/adafruit/Adafruit_WebSerial_ESPTool), now we can flash ESP32 boards directly from the web browser using Web Serial API! No setup or installation required. Just go to the website, select the program and upload to the board!
Select 115200, Offset 0x1000 and the just downloaded file: firmware.bin. Click on Connect and then Program.
Be patient – it took about 20 minutes to flash on my environment, but it was worth every minute, as no software install was required! Moreover, you will only need to do this once! After some minutes, the process is complete:
MicroPython
After flashing MicroPython firmware, have to remove the jumper cable from pin IO0 to GND, to leave flash mode, and then reset the board. After that, the MicroPython prompt should be available over the serial port. You can easily access the board serial port using BIPES serial:
Searching the web today, I found freeboard – an amazingly wonderful and powerful open source platform to easily build dashboards. As I understand, it was created by Jim Heising and Bug Labs.
freeboardis completely client site and so organized and well structured, that in 5 minutes I cloned github repository and got freeboard running on BIPES server:
From that URL above, anyone can easily add widgets, datasources, panes, move panes, etc. Moreover, it can easily get data from MQTT server, so we can integrate it with BIPES EasyMQTT! As I looked for examples and plugins, I quickly found this fork, with highly flexible and complete customization options, by Daniel Dunn:
Now we can use BIPES EasyMQTT JSON API to get the latest data published by the ESP8266 board and update a freeboard dashboard. Here are the endpoints I used:
On the IOT tab, which is an iframe to freeboard index.html, I simply had to add a JSON data source for each of the 3 links above, adding each URL to each data source.
After that, it is possible to create panes and add widgets to panes. I used text, gauge and buttons widgets. For the text and gauge widgets, it is easy to select the data source with auto-completion:
For the buttons, I had to use one nice and powerful feature of freeboard, which is to trigger a Javascript code when the button is pressed.
In that way, I used the JS Editor and added this code, which will make a request to BIPES MQTT server and change the value of the relay topic after the click. Here is the code I used for on ON Button:
function httpGetAsync(theUrl, callback)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
this.onClick = function(){
httpGetAsync("http://bipes.net.br/easymqtt/publish.php?session=vn28pd&topic=relay&value=1");
};
The OFF Button has the same configurations, but changing value=1 to value=0.
And here is the result:
While program is running on the ESP8266 board, data can be seen in real time, and if we click on the “Relay ON” button, a message is shown on the terminal.
If you want to play with this specific dashboard, you can download it from here:
Then open the IOT tab, click on upload freeboard and upload this file. You can modify / customize / adjust it.
Another interesting possibility is to load only the dashboard, without BIPES. For example, you used BIPES to create your program, but you only want to share the dashboard with other people. In that way, you can share the dashboard with a link like this:
Which, by the way, is responsive and loads / adjusts nicely to several devices. Here are some prints from this link on my Android phone:
Please note, that this text / discussion is a first impression / test of BIPES + freeboard integration. There are bugs and features to make a seamless integration:
Zoom control: on some screens I tested, the freeboard toolbar stays out of the screen. Changing the zoom helps get access to the toolbar, but a better solution is needed;
Add a nice “Powered by freeboard” somewhere (I removed the logo because it was too big, bug would like to see it);
Implement storage / sharing of freeboard using BIPES style (link with code);
Automatic integration with BIPES: when EasyMQTT session is created, automatically populate freeboard datasources;
For BIPES Serial version, create a channel from the terminal to local datasources using Javascript variables, so that a serial protocol can send data to be viewed on the freeboard dashboard without Internet connection.
BIPES has a new website, based on WodPress (thanks WordPress!) with an integrated forum. As the project grows, and documentation / collaboration is needed each time more, this is an important step. Updating information and discussing with users and developers is easier now.
The new site is below, and some posts about BIPES that I have been doing here on this blog may probably go to the new website:
This week I had one strange problem with a MySQL server after reloading a dump into a fresh MySQL (MariaDB) install. After that, everytime I restarted a MySQL server, data from a specific table were lost. Only from that specific table! No data corruption, error, etc. Just rows from that table disappear after each restart!
After careful looking at the database structure, I saw something unexpected:
show create table data;
| data |CREATE TABLE `data` (
`id` int NOT NULL AUTO_INCREMENT,
`ts` datetime NOT NULL,
`s1` float DEFAULT NULL,
`sensor` int DEFAULT NULL,
PRIMARY KEY (`id`),
) ENGINE=Memory
Wow. ENGINE=Memory?
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.01 sec)
MEMORY writes table data in-memory. While the table structures are persisted on-disk, the rows in MEMORY tables are lost when MySQL stops.
Just changed the engine to InnoDB and problem solved! Strange that I never explicitly defined this table as using “memory engine”, but anyway, problem solved 😉