Something special arrived on my doorstep this week!
I immediately had to open the boxes to see what was inside:
It is a collection of Project14 shopping carts!
I am beyond enamored to be recognized by the Project14 organizers and community for my project entries!
I truly don't have have the words to express my gratitude.
So, I as thank you, I put together a quick and simple IOT Project 14 trophy!
IOT Trophy
Currently the IOT is a very simple build consisting of:
- ESP8266 NodeMCU V3
- MicroPython
- SSD1306 I2C monochrome OLED 128x64 pixel display
boot.py
# This file is executed on every boot (including wake-boot from deepsleep)
import uos, machine, esp, network, time
import gc
gc.collect()
t0 = time.ticks_us()
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect('ssid', 'pass')
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
print( 'Wifi connect time: {} ms'.format((time.ticks_us() - t0)/1000) )
main.py
There is lots that could be improved here, but its enough to say thanks 
from machine import Pin, I2C
import ssd1306
import socket
import ssl
import re
i2c = I2C(scl=Pin(14), sda=Pin(12), freq=100000)
display = ssd1306.SSD1306_I2C(128, 64, i2c)
rep = {'points' : 0, 'level' : 0, 'GrandPrize' : 0, 'FirstPrize' : 0 }
url = 'http://2n3904blog.com/element14/'
_, _, host, path = url.split('/', 3)
addr = socket.getaddrinfo(host, 80)[0][-1]
s = socket.socket()
s.connect(addr)
s.send(bytes('GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n' % (path, host), 'utf8'))
while True:
dat = s.read(2048)
if dat:
idx = dat.find(b'scottie')
if idx >= 0:
print('Found Scottie @ index: {}'.format(idx))
m = re.search('<p>Points: <strong>([0-9]+)</strong></p>',dat)
rep['points'] = int(m.group(1))
m = re.search('<p>Level: ([0-9]+)</p>',dat)
rep['level'] = int(m.group(1))
m = re.search('<p>GP: ([0-9]+)</p>',dat)
rep['GrandPrize'] = int(m.group(1))
m = re.search('<p>FP: ([0-9]+)</p>',dat)
rep['FirstPrize'] = int(m.group(1))
else:
break
s.close()
display.text('#~ Project 14 ~#', 0, 0, 1)
display.text('@scottiebabe', 0, 10, 1)
display.text('({}) {} pts'.format(rep['level'],rep['points']), 0, 20, 1)
display.text('GP: {}, FP: {} '.format(rep['GrandPrize'], rep['FirstPrize']), 0, 30, 1)
display.text('EM Surfer', 0, 50, 1)
display.show()There are definitely still some refinements to be made in the future. I need to determine how to load ssl certificates into uPython, as only a few webservers seem to be supported presently. A low power display is a absolute must for long-term battery powered operation. And, of course, a nicer mechanical build, perhaps a 3-D printed trophy with a display mount.
Finally, If you have been on the fence about whether or not to submit a Project14 entry, based on my experience, I would say absolutely go for it. Its a lot fun, there are great prizes, and most importantly you get to share your creations with the world.
Looking forward to the next project.




-
javagoza
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Comment-
javagoza
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Children