Hi I am currently working with a RT1062 board and have tested the frame streaming example as well as created code for receiving/executing python scripts from a client over a socket similar.
I have also tested the wifi shield with other cameras and find the wifi debugging experience great. I was wondering if there is any plan to implement this with the RT1062s onboard wifi? As I have had difficultly with sending scripts to execute on the board from a client in a non blocking way without the use of async or threads. Thanks!
Thanks for sharing that and asking for WiFi debugging on the RT1062.
Yes, I will be implementing this feature on the system later this year.
However, we plan to refactor how it works. We’re going to remove the config ini file and have you just setup WiFi in boot.py. Then there will be a call in the OMV module to enable the WiFi debugging client and server threads to run in the background via a timer callback under the hood.
This will then allow the feature to work well current and future OpenMV Cams including all the Arduino ones.
Right now the code is written for the WINC1500 only. So, instead of just porting to the CY4343 WiFi chipset we want to do a better job integrating the feature. The best way to do this is to put it in boot.py.
Note, the reason for moving to boot.py is so WiFi is setup on turn on. Then this allows scripts to just use sockets directly without having to set WiFi up which means you can then easily start and stop code without issues and breaking the WiFi debug interface connection.
hi,
i am using the OpenMV Cam RT1062 with the default example mjpeg-streamer-ap.py (in file → examples → wifi). i want to connect with my iphone. but wen i start the Code i can not find the wifi ssid in my iphone. can anyone help me please?
# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# MJPEG Streaming AP.
#
# This example shows off how to do MJPEG streaming in AccessPoint mode.
# Chrome, Firefox and MJpegViewer App on Android have been tested.
# Connect to OPENMV_AP and use this URL: http://192.168.1.1:8080 to view the stream.
import sensor
import time
import network
import socket
import image
SSID = "OPENMV_AP" # Network SSID
KEY = "1234567890" # Network key (must be 10 chars)
HOST = "" # Use first available interface
PORT = 8080 # Arbitrary non-privileged port
# Reset sensor
sensor.reset()
sensor.set_framesize(sensor.QQVGA)
sensor.set_pixformat(sensor.RGB565)
# Init wlan module in AP mode.
wlan = network.WLAN(network.AP_IF)
wlan.active(False)
wlan.config(ssid=SSID, key=KEY, channel=2)
wlan.active(True)
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
# You can block waiting for client to connect
# print(wlan.wait_for_sta(100000))
def start_streaming(client):
# Read request from client
data = client.recv(1024)
# Should parse client request here
# Send multipart header
client.send(
"HTTP/1.1 200 OK\r\n"
"Server: OpenMV\r\n"
"Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n"
"Cache-Control: no-cache\r\n"
"Pragma: no-cache\r\n\r\n"
)
# FPS clock
clock = time.clock()
# Start streaming images
# NOTE: Disable IDE preview to increase streaming FPS.
while True:
clock.tick() # Track elapsed milliseconds between snapshots().
frame = sensor.snapshot()
cframe = frame.compressed(quality=50, subsampling=image.JPEG_SUBSAMPLING_422)
header = (
"\r\n--openmv\r\n"
"Content-Type: image/jpeg\r\n"
"Content-Length:" + str(cframe.size()) + "\r\n\r\n"
)
client.sendall(header)
client.sendall(cframe)
print(clock.fps())
server = None
while True:
if server is None:
# Create server socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
# Bind and listen
server.bind([HOST, PORT])
server.listen(5)
# Set server socket to blocking
server.setblocking(True)
try:
print("Waiting for connections..")
client, addr = server.accept()
except OSError as e:
server.close()
server = None
print("server socket error:", e)
continue
try:
# set client socket timeout to 2s
client.settimeout(5.0)
print("Connected to " + addr[0] + ":" + str(addr[1]))
start_streaming(client)
except OSError as e:
client.close()
print("client socket error:", e)
# sys.print_exception(e)
I recommend using the RSTP streamer though. This example isn’t the most robust. It works for me but has hiccups.
Use the latest development firmware to run it and connect to port 8080 of the IP address of the camera.
Also, make sure your phone is actually on the right wifi network.
is the KEY required to be entered anywhere. it says its open and doesnt require a passkey.
Can see the Access Point, can connect, but no picture .
You have to connect to the WiFi network of the OpenMV Cam when it’s in AP mode which requires a Key.
Tried with VLC player , says it cannot be played or multiple media cannot be played.
This is not RSTP streaming. It just works with a browser.
Tried using the i.p. the device showed . also tried the 192.168.1.1 but thats the main routers i.p. is that ip mandatory to use?
This is an access point script. You are connecting to a wireless network that the OpenMV Cam is creating. If you want it to join the WiFi network that all your other devices are on do not use the access point script.
…
The above script 100% works with the latest firmware if you follow my instructions. You just connect to the WiFi network with your phone/pc and then go to the IP address the camera prints out in the IDE and use the port number 8080. “http://192.168.1.1:8080”