Skip to content

Commit b1ce1f2

Browse files
committed
update to 1.0.8
1 parent bd11216 commit b1ce1f2

File tree

8 files changed

+78
-25
lines changed

8 files changed

+78
-25
lines changed

README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,39 @@ First, connect the ESP32 board to the WiFi by creating boot.py file and writing
3939
```python
4040
import network
4141
import esp
42+
import time
4243
esp.osdebug(None)
4344
import gc
4445
gc.collect()
4546

46-
ssid = 'WIFI_NAME'
47-
password = 'WIFI_PASSWORD'
47+
# set WiFi credentials
48+
ssid = ''
49+
password = ''
4850

49-
station = network.WLAN(network.STA_IF)
51+
# check if there is username and password for wifi
52+
if(ssid != '' and password != ''):
5053

51-
station.active(True)
52-
station.connect(ssid, password)
54+
station = network.WLAN(network.STA_IF)
5355

54-
while station.isconnected() == False:
55-
pass
56+
station.active(True)
57+
station.connect(ssid, password)
5658

57-
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
59+
timeout_interval = 10
60+
61+
# try to connect with timeout interval
62+
for i in range(0,timeout_interval):
63+
if(station.isconnected() == False):
64+
time.sleep(1)
65+
pass
66+
else:
67+
break;
68+
69+
if(station.isconnected()):
70+
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
71+
else:
72+
print("Something went wrong, connection timeout, try again!")
73+
else:
74+
print("Please add WiFi credentials properly")
5875
```
5976

6077
Make sure to change WiFi ESSID and Password. Once the ESP32 is connected to the Wifi, run the following commands:
@@ -68,6 +85,27 @@ This will install the latest version of micropython-eduponics package through up
6885

6986
Examples are available in the examples/ directory.
7087

88+
## Using firmwares
89+
90+
Alternatively, you can burn a ready made firmware which located under the repository firmwares directory
91+
currently 2 firmware available:
92+
93+
1. 4M-eduponics-micropython.bin - firmware includes micropython-eduponics library pre-installed (without the MQTT client).
94+
2. 4M-eduponics-MQTT.bin - firmware includes the MQTT library and everything you need to get started with the Eduponics mobile app.
95+
96+
To flash the firmware, run the following command using esptool.py
97+
```
98+
esptool.py --baud 115200 --port <port_name> write_flash 0x0 <firmware_name>.bin
99+
```
100+
Where <firmware_name> is the file name (the bin file you want to flash) and <port_name> is the port name to flash through.
101+
102+
Current firmware version: MicroPython v1.13 on 2020-09-02; ESP32 module with ESP32
103+
104+
## Changing MQTT broker
105+
106+
In order to change the MQTT broker, change the umqttsimple.py file inside the [/Eduponics/](/Eduponics/umqttsimple.py) directory
107+
Make sure to properly mark whenever you use SSL or not.
108+
71109
## License
72110

73111
MIT License

eduponics/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.7"
1+
__version__ = "1.0.8"

eduponics/ads1x15.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# THE SOFTWARE.
2424

2525
import utime as time
26-
from eduponics import mcp23017
26+
from Eduponics import mcp23017
2727

2828
_REGISTER_CONVERT = const(0x00)
2929
_REGISTER_CONFIG = const(0x01)

eduponics/tds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'''
2525

2626
import time
27-
from eduponics import ads1x15
27+
from Eduponics import ads1x15
2828
from ulab import array,numerical
2929
from machine import I2C, Pin
3030
import time

examples/eduponics_mqtt/boot.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,38 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24-
25-
from umqttsimple import MQTTClient
2624
import network
2725
import esp
26+
import time
2827
esp.osdebug(None)
2928
import gc
3029
gc.collect()
3130

32-
ssid = 'WIFI_NAME'
33-
password = 'WIFI_PASSWORD'
31+
# set WiFi credentials
32+
ssid = ''
33+
password = ''
34+
35+
# check if there is username and password for wifi
36+
if(ssid != '' and password != ''):
37+
38+
station = network.WLAN(network.STA_IF)
3439

35-
station = network.WLAN(network.STA_IF)
40+
station.active(True)
41+
station.connect(ssid, password)
3642

37-
station.active(True)
38-
station.connect(ssid, password)
43+
timeout_interval = 10
3944

40-
while station.isconnected() == False:
41-
pass
45+
# try to connect with timeout interval
46+
for i in range(0,timeout_interval):
47+
if(station.isconnected() == False):
48+
time.sleep(1)
49+
pass
50+
else:
51+
break;
4252

43-
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
53+
if(station.isconnected()):
54+
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
55+
else:
56+
print("Something went wrong, connection timeout, try again!")
57+
else:
58+
print("Please add WiFi credentials properly")

extensions/extension_board/mcp23017_relays.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
i2c = I2C(scl=Pin(33), sda=Pin(32))
3939

4040
# initialize relay object
41-
relays = mcp23017.Relays(i2c, address=0x20)
41+
relays = mcp23017.Relays(i2c, address=0x27)
4242

4343
# open relays one by one
4444
for i in range(0,4):

extensions/extension_board/mcp23017_soil_moisture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# setup adc for the extension board
4141
ads_address = 0x48
42-
mcp_address = 0x20
42+
mcp_address = 0x27
4343
gain = 1
4444

4545
adc = ads1x15.ADS1115(i2c=i2c, address=ads_address,mcp_address=mcp_address, gain=gain)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup, find_packages
66
from setuptools.command.test import test as TestCommand
77

8-
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'eduponics')))
8+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'Eduponics')))
99

1010
from eduponics import __version__
1111
sys.path.pop(0)
@@ -20,7 +20,7 @@
2020
packages=find_packages(),
2121
include_package_data=True,
2222
version=__version__,
23-
download_url = 'https://github.com/STEMinds/micropython-eduponics/archive/1.0.7.tar.gz',
23+
download_url = 'https://github.com/STEMinds/micropython-eduponics/archive/1.0,8.tar.gz',
2424
keywords = ["STEMinds",'MicroPython','uPython', 'Eduponics-Mini', 'Eduponics', 'ESP32', 'ADS1x15', 'MCP23017', 'TDS', 'pH', 'bh1750', 'BME280', 'DS1307', 'AT24C02'],
2525
description='STEMinds Eduponics Mini MicroPython library',
2626
long_description=long_description,

0 commit comments

Comments
 (0)