I'm trying to connect my Arduino Nano RP2040 with MicroPython to my local WiFi network and make a HTTP request.
The Nina W102 uBlox module on the board is an ESP32 and connects to the RP2040 via SPI (I'm not sure what this means but I thought it might be relevant).
I've found this code snippet that seems to do what I want
def do_connect():
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect('SKYNET', 'G1V31NT3RN3T')
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
do_connect()
But it breaks with:
Traceback (most recent call last): File "", line 1, in
ImportError: no module named 'network'
Im using Thonny as an editor and tried to search their packages for something called "Network" and found a match. But that gives me the below error/warning.
Any help or tips greatly appreciated.
UPDATE 1: Found this example with WiFi using CircuitPython. Would prefer to use MicroPython, but if all else fails I might have to switch firmwares.
https://learn.adafruit.com/circuitpython-on-the-arduino-nano-rp2040-connect/wifi
UPDATE 2: Opted to use CircuitPython. Getting WiFi was then quite easy.
Raspberry Pi Pico does not have any network capability.
Your provided code looks like from micropython for chips, that has wifi inside (ESP family, some others)
Looks like Arduino RP2040 board has wifi option, but via Nina W102 uBlox, using SPI, witch is ESP32 under the hood. Probably, Nina's firmware is to provide WIFI/BLE and being controlled via SPI.
I assume, Adafruit wrote circuitpython driver to control Nina chip. My wild guess is that Nina uses AT+ commands. Sometimes circuityphons libs works on micropython. If that is not the case this time- you need network driver for it. Quick search did not gave me any result.
Conclusion- use Circuipython or write/find driver for Nina on Micropython
Related
I have a Wiznet 5100S Pico on which I installed W5100S_EVB_PICO-20220618-v1.19.1.uf2 from the micropython site.
I wrote a small routine for my Wiznet 5100S Pico in Thonny, neglecting to add parameters when I initialized it.
import network
import socket
from machine import Pin
import time
import config
nic = network.WIZNET5K()
The routine runs fine. But it's time to expand it, so I created a new project in PyCharm. Now the code checker is warning me that I'm missing parameters in the nic = network.WIZNET5K() line.
Just wondering if this is an issue or did Micropython cover adding the proper parameters in their firmware for this model?
I am trying to retrieive heart-rate date from a polar belt to use as part of emotion recognition algorithm. I am using a Raspberry pi 3b with raspbian. I am able to connect to the device with bluetoothctl When I open info I get a list of the UUID´s
Here is where it stops. I have tried to use hcitool according to the example below, but that does not work. When I try to connect I get the message: Connection Refused(111)
$ sudo gatttool -i hci1 -b 00:22:D0:33:1E:0F -I
[ ][00:22:D0:33:1E:0F][LE]> connect
[CON][00:22:D0:33:1E:0F][LE]>
So I tried to use bleak and pygatt and I´m not able to make this work. I am quite a newbee, so I am probably doing something wrong. But now I have run out of ideas. Any suggestions will be appreciated.
hciattach, hciconfig, hcitool, hcidump, rfcomm, sdptool, ciptool, and gatttool were deprecated by the BlueZ project in 2017. If you are following a tutorial that uses them, there is a chance that it might be out of date.
For testing it is best to use the bluetoothctl tool.
You say that you have successfully connected and get a list of UUIDs. Was 00002A37-0000-1000-8000-00805F9B34FB one of them?
If it is then select that inside bluetoothctl e.g.
gatt.select-attribute 00002a37-0000-1000-8000-00805f9b34fb
If that is succussful then you should be able to read the value with:
gatt.read
Or to test notifications:
gatt.notify on
This should start data being displayed from the belt.
gatt.notify off will stop the data being sent.
If you have this working with bluetoothctl then reproducing it with Python should be done with confidence that the RPi and belt are able to connect successfully.
There is an example of building a BLE client with Python at:
https://stackoverflow.com/a/63751113/7721752
I noticed in your gatttool example you are using hci1 rather than the more typical value of hci0. This is normally the case if you have added a USB BLE dongle. I the above example you would have to change ADAPTER_PATH = '/org/bluez/hci0' to end with hci1.
There is also the example with Bleak at:
https://stackoverflow.com/a/72541361/7721752
For bleak to select an alternative adapter would add the adapter address to the BleakClient e.g.:
async with BleakClient(address, adapter="yy:yy:yy:yy:yy:yy") as client:
I've been trying to figure out how to upload a code to a STM32103c8T bulepill board.
My setup is
1- MacOs Catalina
2- STM32103c8T bulepill board
3- SLAB UART USB-TTL CP2012 V3.0
4- Platformio IDE
5- STM32 CUBE Programmer software which detects and connects to my board through UART.
meaning that It has no problem connecting but there are issue with setting up the Platformio
BTW I am new to the ARM world and I bought this board to examine its speed and deep sleep and interrupt, I mean all the things that an Arduino Uno can't do.
The thing is I have no idea on how to setup the platformio.ini File to comunicate with the board
using the UART method and not requesting ST-link dongle!
What I have now in Platformio.ini is:
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink
upload_port = tty.slab_usbtoUART
and when trying to upload the program i get:
Uploading .pio/build/bluepill_f103c8/firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
none separate
Error: open failed
in procedure 'program'
OpenOCD init failed
shutdown command invoked
[upload] Error 1
I just need help getting the system talk to each-other and see each-other
P.S.
I want to go as bareMetal as possible and not to use arduino firmware HAL
You can use the following configurations:
upload_protocol = serial
upload_port = COMX/ttyx //whichever applies
I have been trying to locate a working library for the MSR605X magnetic card reader/writer. At time of writing, I have tried five separate libraries. Only two of these were explicitly for the 605X the other three were for the older 605. All the libraries I have tried either did nothing at all or errored before completing a command (can't figure out the errors either).
I am running Raspberry Pi OS 32 bit on a Raspberry Pi 3 B+ the MSR605X communicates via a USB connection.
So far the library that seems to be most complete is: https://pypi.org/project/msrx/
However, I can not get this library to read or write (either nothing happens or I get a Serial exception "cannot reconfig port).
Any help or links to documentation for this reader is welcome.
EDIT: Adding the commands ran with the above library
msrx -D /dev/input/event4 read
msrx -D /dev/input/jso0 read
The -D is to specify the device path (default is /dev/ttyUSB0 which doesn't exist on my system). I obtained the above two paths by searching for USB serial devices then matching the search result to the device ID which I obtained from lsusb.
Running these commands results in a serial exception (could not reconfig port) which I assume means that I have the wrong device path. I have also checked for any tty* device paths that are changed when I plug in the reader. I consistently get a permission denied error whenever trying to run the above commands with a tty* device path (I am root on this system).
msrx author here — MSR605 requires an external 9V power injected into its cable (via the barrel jack port), otherwise it won't power up properly.
I'm sorry for that stupid question but I really can't find what I need.
I made a code to use a ESP Wrover 32 with PlatformIO/VScode and I need to upload the code to the ESP32 (connected to the computer using USB) but I can't find how to select the right USB port to upload the code.
The error is :
Please specify 'upload_port' for environment or use global
'--upload-port' option.
I tried to use the command lines but nothing works.
How can I upload my code ?
Thanks
To find the USB port: Hit WindowsKey-X, select Device Manager, plug in the device and observe what's listed under Ports (COM & LPT) - the one that just appeared has the port in brackets (COMn).
Then in platformio.ini in your PlatformIo initialised project folder, you specify the port as a line under the platform section (env: square brackets line): upload_port = com9 or whatever you got from Device Manager.
I hope this helps.