johnmcd-ff / LoPy

Pycom LoPy getting started
5 stars 0 forks source link
pycom-lopy

LoPy

PYcom LoPy getting started

https://docs.pycom.io/pycom_esp32/pycom_esp32/getstarted.html

Other resources:

https://www.facebook.com/Pycom-LoPy-Triple-Network-IoT-Development-Board-985976714802190/

Our kit consists of: 2 x LoPy pcbs 2 x expansion pcbs 2 x antenna 2 x cases

Make a close inspection of the jumper connections on the expansion board. They come lose easily and may still be in the packing. All pins should have jumpers.

Connect the LoPy board to the expansion board. Take note of orientation: Insert the module on the expansion board with the reset button pointing in the same direction as the USB connector. Fit the antenna pigtail coax to the case using the lock washer and nut supplied. It's important to connect the antenna to the LoPy to prevent damage to the RF circuit from an unmatched output. Hold the small connector carefully, line up with the pcb and push firmly.

LoPy antenna

LoPy antenna close

Note that the pigtail antenna connection has a 'flat' on it to orientate in the case. I've also used a cable tie to hold the pigtail to the case as a strain relief.

Upgrade Firmware

download the upgrade tool from Pycom https://docs.pycom.io/pycom_esp32/pycom_esp32/getstarted.html#firmware-upgrades

First use a wire to connect GND and G23 on the expansion board. Looking at board with USB at top/Pycom logo on left: GND is 2nd from top on right side, G23 is 4th from top on left side.

dsc_0654

When the upgrade tool asks for the connected COM port, if you're not sure open Device Manager (windows) and check the Ports list.

Follow upgrade instructions and should be done in about 1 minute. When asked select New Zealand from the list. LoPy upgrade Close the upgrade tool. Remote the jumper cable press the Reset button on the LoPy (next to the big LED.

Important note on LoRa transmitting

The frequency band we can use in NZ is 915MHz to 928MHZ. When you start using your device on Lora to transmit, make sure you only set the frequency in this band. Do NOT use a frequency between 902-915MHz.

Start Programming

Let's first check our firmware version.

Start Pymakr (download from Pycom if necessary) Open menu: Settings>Preferences>Pycom Device Ensure Device has correct Com port selected (a username/password should not be required for a USB cable connection) Pycom settings

Type these two commands:

import os
os.uname().release

The response is the latest version. In my case 1.5.0.b2

Pycom check

Hello LoPy

At the prompt type:

print("Hello LoPy")

Hello LoPy

Traffic Light program

Select New Program, either by Menu>File>New or Press button new program

type in following, remember indentation is important:

import pycom 
import time
pycom.heartbeat(False)
for cycles in range(10):
        pycom.rgbled(0x007f00)
        time.sleep(5)
        pycom.rgbled(0x4f4f00)
        time.sleep(1.5)
        pycom.rgbled(0x7f0000)
        time.sleep(4)

Press Run pycom run The LoPy LED will start flashing.

Save the program as TrafficLight pycom wifi

Any problems? Press CTRL-D

pycmctrl-d