Skip to content

Commit

Permalink
update to 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Zontex committed Jul 15, 2021
1 parent bd11216 commit b1ce1f2
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 25 deletions.
54 changes: 46 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,39 @@ First, connect the ESP32 board to the WiFi by creating boot.py file and writing
```python
import network
import esp
import time
esp.osdebug(None)
import gc
gc.collect()

ssid = 'WIFI_NAME'
password = 'WIFI_PASSWORD'
# set WiFi credentials
ssid = ''
password = ''

station = network.WLAN(network.STA_IF)
# check if there is username and password for wifi
if(ssid != '' and password != ''):

station.active(True)
station.connect(ssid, password)
station = network.WLAN(network.STA_IF)

while station.isconnected() == False:
pass
station.active(True)
station.connect(ssid, password)

print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
timeout_interval = 10

# try to connect with timeout interval
for i in range(0,timeout_interval):
if(station.isconnected() == False):
time.sleep(1)
pass
else:
break;

if(station.isconnected()):
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
else:
print("Something went wrong, connection timeout, try again!")
else:
print("Please add WiFi credentials properly")
```

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

Examples are available in the examples/ directory.

## Using firmwares

Alternatively, you can burn a ready made firmware which located under the repository firmwares directory
currently 2 firmware available:

1. 4M-eduponics-micropython.bin - firmware includes micropython-eduponics library pre-installed (without the MQTT client).
2. 4M-eduponics-MQTT.bin - firmware includes the MQTT library and everything you need to get started with the Eduponics mobile app.

To flash the firmware, run the following command using esptool.py
```
esptool.py --baud 115200 --port <port_name> write_flash 0x0 <firmware_name>.bin
```
Where <firmware_name> is the file name (the bin file you want to flash) and <port_name> is the port name to flash through.

Current firmware version: MicroPython v1.13 on 2020-09-02; ESP32 module with ESP32

## Changing MQTT broker

In order to change the MQTT broker, change the umqttsimple.py file inside the [/Eduponics/](/Eduponics/umqttsimple.py) directory
Make sure to properly mark whenever you use SSL or not.

## License

MIT License
Expand Down
2 changes: 1 addition & 1 deletion eduponics/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.7"
__version__ = "1.0.8"
2 changes: 1 addition & 1 deletion eduponics/ads1x15.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# THE SOFTWARE.

import utime as time
from eduponics import mcp23017
from Eduponics import mcp23017

_REGISTER_CONVERT = const(0x00)
_REGISTER_CONFIG = const(0x01)
Expand Down
2 changes: 1 addition & 1 deletion eduponics/tds.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'''

import time
from eduponics import ads1x15
from Eduponics import ads1x15
from ulab import array,numerical
from machine import I2C, Pin
import time
Expand Down
35 changes: 25 additions & 10 deletions examples/eduponics_mqtt/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,38 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from umqttsimple import MQTTClient
import network
import esp
import time
esp.osdebug(None)
import gc
gc.collect()

ssid = 'WIFI_NAME'
password = 'WIFI_PASSWORD'
# set WiFi credentials
ssid = ''
password = ''

# check if there is username and password for wifi
if(ssid != '' and password != ''):

station = network.WLAN(network.STA_IF)

station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)

station.active(True)
station.connect(ssid, password)
timeout_interval = 10

while station.isconnected() == False:
pass
# try to connect with timeout interval
for i in range(0,timeout_interval):
if(station.isconnected() == False):
time.sleep(1)
pass
else:
break;

print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
if(station.isconnected()):
print('Connected to WiFi successfully, IP: %s' % station.ifconfig()[0])
else:
print("Something went wrong, connection timeout, try again!")
else:
print("Please add WiFi credentials properly")
2 changes: 1 addition & 1 deletion extensions/extension_board/mcp23017_relays.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
i2c = I2C(scl=Pin(33), sda=Pin(32))

# initialize relay object
relays = mcp23017.Relays(i2c, address=0x20)
relays = mcp23017.Relays(i2c, address=0x27)

# open relays one by one
for i in range(0,4):
Expand Down
2 changes: 1 addition & 1 deletion extensions/extension_board/mcp23017_soil_moisture.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

# setup adc for the extension board
ads_address = 0x48
mcp_address = 0x20
mcp_address = 0x27
gain = 1

adc = ads1x15.ADS1115(i2c=i2c, address=ads_address,mcp_address=mcp_address, gain=gain)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

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

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

0 comments on commit b1ce1f2

Please sign in to comment.