Anyone got wifi modules working with this board?
-
- Posts: 1
- Joined: Thu Nov 16, 2017 3:19 am
Anyone got wifi modules working with this board?
Hi I own one of this board, and feel like getting a wifi module working with it. Is there any known way to do it currently?
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: Anyone got wifi modules working with this board?
The pyboard has support for the C3x00 wifi modules. Unfortunately these are rather expensive.
http://docs.micropython.org/en/latest/p ... class-cc3k
Support the C3K module is not compiled in by default on the pyboard. I believe you need to change 0 to a 1 on the line
in ports/unix/mpconfigport.mk and recompile and flash the firmware. Unfortunately, I can't get it to compile with the latest version of the repo:
Maybe others can chime with more knowledge?
http://docs.micropython.org/en/latest/p ... class-cc3k
Support the C3K module is not compiled in by default on the pyboard. I believe you need to change 0 to a 1 on the line
Code: Select all
MICROPY_PY_CC3K ?= 0
Code: Select all
$ make BOARD=PYBV11
[...]
CC modnetwork.c
In file included from ../../py/objlist.h:29:0,
from modnetwork.c:31:
modnetwork.c:80:19: error: 'MP_QSTR_CC3K' undeclared here (not in a function); did you mean 'MP_QSTR_C3'?
{ MP_ROM_QSTR(MP_QSTR_CC3K), MP_ROM_PTR(&mod_network_nic_type_cc3k) },
^
../../py/obj.h:92:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2))
^~~
modnetwork.c:80:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_CC3K), MP_ROM_PTR(&mod_network_nic_type_cc3k) },
^~~~~~~~~~~
make: *** [../../py/mkrules.mk:47: build-PYBV11/modnetwork.o] Fehler 1
Re: Anyone got wifi modules working with this board?
hello, I used the esp-01(ESP8266) as the wifi module and everything is working fine for me. This module connects to the pyboard using uart module and its mode is AP, but can be configured as a station or the combination of both. Below is my code example
import pyb
from pyb import delay
Led_Red, Led_Green, Led_Yellow = [pyb.LED(i) for i in (1, 2, 3)]
uart = pyb.UART(3, 115200)
uart.init(115200, bits=8, parity=None, stop=1)
def send_command(cmd, delay_time):
# AT commands must be finalized with an '\r\n'
uart.write(cmd)
# wait at maximum one second for a command reaction
delay(delay_time)
if uart.any():
return(uart.read())
def send_data(data, delay_time):
# Send data to the ESP8266
uart.write(data)
# wait at maximum one second for a command reaction
delay(delay_time)
if uart.any():
return(uart.read())
def sendCIPData(conn, datas):
'''
Name: sendCIPDATA
Description: sends a CIPSEND=<connectionId>,<data> command
'''
cipsend = 'AT+CIPSEND=%s,%s\r\n'
cipsend = cipsend % (conn, len(datas))
print(send_command(cipsend,1000))
send_data(datas,1000)
print(send_command('ATE0\r\n',1000))
print(send_command('AT+RST\r\n',2000))
print(send_command('AT+CWMODE=1\r\n',1000))
print(send_command("AT+CWJAP=\"xxxxxx\",\"xxxxxxxxx\"\r\n",3000))
delay(2000)
print(send_command('AT+CIFSR\r\n',1000))
print(send_command('AT+CIPMUX=1\r\n',1000))
print(send_command('AT+CIPSERVER=1,xxx\r\n',1000))
response = """HTTP/1.1 200 OK\r\nContent-Type: text;\r\nContent-length: %s\r\nConnection: keep-alive\r\n\r\n%s\r\n
"""
global content
content = 'hello micropython world!'
while True:
if uart.any():
request = uart.read()
#from request extraction connection ID, which will be after the '+IPD,' from the
request sting
#Also from the same string extract the get request
connID = request[8:9] # This is an example
reply = response % (len(content), content)
sendCIPData(connID, reply)
closecmd = 'AT+CIPCLOSE=%s\r\n'
closecmd = closecmd % connID
send_command(closecmd, 500)
import pyb
from pyb import delay
Led_Red, Led_Green, Led_Yellow = [pyb.LED(i) for i in (1, 2, 3)]
uart = pyb.UART(3, 115200)
uart.init(115200, bits=8, parity=None, stop=1)
def send_command(cmd, delay_time):
# AT commands must be finalized with an '\r\n'
uart.write(cmd)
# wait at maximum one second for a command reaction
delay(delay_time)
if uart.any():
return(uart.read())
def send_data(data, delay_time):
# Send data to the ESP8266
uart.write(data)
# wait at maximum one second for a command reaction
delay(delay_time)
if uart.any():
return(uart.read())
def sendCIPData(conn, datas):
'''
Name: sendCIPDATA
Description: sends a CIPSEND=<connectionId>,<data> command
'''
cipsend = 'AT+CIPSEND=%s,%s\r\n'
cipsend = cipsend % (conn, len(datas))
print(send_command(cipsend,1000))
send_data(datas,1000)
print(send_command('ATE0\r\n',1000))
print(send_command('AT+RST\r\n',2000))
print(send_command('AT+CWMODE=1\r\n',1000))
print(send_command("AT+CWJAP=\"xxxxxx\",\"xxxxxxxxx\"\r\n",3000))
delay(2000)
print(send_command('AT+CIFSR\r\n',1000))
print(send_command('AT+CIPMUX=1\r\n',1000))
print(send_command('AT+CIPSERVER=1,xxx\r\n',1000))
response = """HTTP/1.1 200 OK\r\nContent-Type: text;\r\nContent-length: %s\r\nConnection: keep-alive\r\n\r\n%s\r\n
"""
global content
content = 'hello micropython world!'
while True:
if uart.any():
request = uart.read()
#from request extraction connection ID, which will be after the '+IPD,' from the
request sting
#Also from the same string extract the get request
connID = request[8:9] # This is an example
reply = response % (len(content), content)
sendCIPData(connID, reply)
closecmd = 'AT+CIPCLOSE=%s\r\n'
closecmd = closecmd % connID
send_command(closecmd, 500)
Re: Anyone got wifi modules working with this board?
Can you explain further how to use ESP-01 with the pyboard?