MedIOT project uses the NodeMCU as main embedded system. It is selected nodeMCU as the main platform because it contains an integrated ESP8266MOD wifi module with Arduino nano board. A digital temperature sensor DS18B20 sensor and Pulse sensor is using as inputs to the nodemodule.
-
Install Arduino SDK and ESP8266 Board Manager
-
Install following Arduino libraries by
Sketch>Library>Library Manager
;
In this, we are using two sensors, Heart Pulse sensor and Temperature sensor. Pulse sensor is given to A0 input, and Temperature sensor DS18B20 given to GPIO input
For ESP.Restart()
nodemcu checking the pins for booting. Here we are boot from the sketch So according to the following table GPIO0 and GPIO1 should connected to 3V3 Vcc and GPIO15 should connected to GND with resistors .
if the wdt reset is triggert the board reboots, when it reboots it is checking the state of GPIO0 and GPIO15 and GPIO2
GPIO15 | GPIO0 | GPIO2 | Mode |
---|---|---|---|
0V | 0V | 3.3V | Uart Bootloader |
0V | 3.3V | 3.3V | Boot sketch |
3.3V | x | x | SDIO mode (not used for Arduino) |
you need to make sure that the pins in the right state when a wtd happens or you call ESP.restart() better you add some delays to prevent the wtd from triggering.
Important : All the above connetions should be made with a 10K resistors
- Compile and Upload the code to the Nodemcu
- Open SerialMonitor
- Restart the Nodemcu
- SoftAP WiFi is set on the relevent ip address shown in the serial monitor. default WiFi SSID->
Mediot1
API end points of the Sever as follows;
Get the status of the server.
URL : /api/status/
Method : GET
Auth required : NO
Permissions required : None
Success Response
Code : 200 OK
{
"status": "ok"
}
Setting the WiFi credentials and API end point of the mqtt server
URL : /api/config/
Method : POST
Auth required : --
Permissions required : --
Data constraints
Provide wifi details and api end point.
{
"ssid":"YOURWIFISSID",
"password":"YOURWIFIPASSWORD",
"link":"MQTT_SERVER"
}
Code : 200 OK
{
"status": "ok"
}
Saving the given wifi credentials and end point
URL : /api/finish
Method : GET
Auth required : NO
Permissions required : None
Success Response
Code : 200 OK
{
"status": "ok"
}