|
Post by bekaheni on Dec 30, 2021 6:36:09 GMT -8
Hi All,
I now have my SkyCam kit up and running just fine, but I am unable to change the SkyCam resolution.
This is what I have done so far :-
Edited 2 lines of testSkyCamRemote.py
Changed MQTTRESOLUTION = 9 to "MQTTRESOLUTION = 13" on line 19
Changed #sendWhatCommand = MQTTRESOLUTION to "#sendWhatCommand = MQTTRESOLUTION" on line 158
I then run sudo python3 testSkyCamRemote.py and get this out put :-
====
log: Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b''
log: Received CONNACK (0, 0)
Connected with result code 0
log: Sending SUBSCRIBE (d0, m1) [(b'SKYCAM/+/INFO', 0)]
log: Received SUBACK
log: Received PUBLISH (d0, q0, r0, m0), 'SKYCAM/AAD1/INFO', ... (403 bytes)
SKYCAM/AAD1/INFO
b'{"id": "AAD1", "messageid": "2352", "messagetype": "4", "softwareversion": "22", "sunairplusdevicepresent": "1", "hdc1080devicepresent": "1", "internaltemperature": "13.17", "internalhumidity": "87.41", "currentrssi": "-41", "batteryvoltage": "4.19", "batterycurrent": "-35.60", "loadvoltage": "4.95", "loadcurrent": "91.50", "solarpanelvoltage": "4.74", "solarpanelcurrent": "0.00", "gndrreboots": "0"}'
sending messagetype 13 to:SKYCAM/AAD1/COMMANDS
log: Sending PUBLISH (d0, q0, r0, m2), 'b'SKYCAM/AAD1/COMMANDS'', ... (62 bytes)
Messge Sent: {"messagetype": 13, "myip": "192.168.68.168", "framesize": 10}
====
But the "WeatherSensMonitor.py" still reports a resolution of "9" see below
====
Picture ID 2353 Good Message 13 Resends: 0
CameraRotation= 90
mySkyCameraText= WeatherSense SkyCam-AAD1 30-Dec-2021 10:42:21
query= INSERT INTO SkyCamPictures (cameraID, picturename, picturesize, messageID, resends,resolution) VALUES('AAD1', 'AAD1_2353_2021-12-30-10-42-21.jpg', 22400, 2353, 0, 9 )
INFO msg Received: b'{"id": "AAD1", "messageid": "2353", "messagetype": "4", "softwareversion": "22", "sunairplusdevicepresent": "1", "hdc1080devicepresent": "1", "internaltemperature": "13.19", "internalhumidity": "87.30", "currentrssi": "-39", "batteryvoltage": "4.18", "batterycurrent": "-34.80", "loadvoltage": "4.95", "loadcurrent": "87.30", "solarpanelvoltage": "4.64", "solarpanelcurrent": "0.00", "gndrreboots": "0"}'
in INFO with SQL
====
Anything I have missed / doing wrong ??
Cheers
Nick
|
|
|
Post by SDL on Dec 30, 2021 10:36:15 GMT -8
Nick,
Try sending a "Blink light " command and see if that is working.
I'm wondering if your camera is receiving the answer.
Would you post the entire program? Use a code block.
I don't know what you have done to the program, but it doesn't look right. The message should be 17, not 13.
BP
|
|
|
Post by bekaheni on Dec 30, 2021 23:50:09 GMT -8
Thank BP,
Sorry I meant 17 not 9 (No idea why I wrote 9 down !!!)
Ok re doing a blink test, well story here ! The flash was working perfect until yesterday ! I even tried taking camera out and plugging a USB power cable into it directly and no flash (as described in another post for testing)
Anyway not bothered about the flash (maybe broken) So to keep things simple just really want to increase the resolution.
Below is the code, so I guess just need to know what lines to change to achieve that, below I have put back code to the original.
Happy New year when it comes BTW !
Cheers Nick
# # tests SkyCam Remote and the updates parameters # import json import paho.mqtt.client as mqtt import os import socket
import traceback #commands
MQTTUPDATEPARAM = 10 MQTTCYCLECHANGE = 11 MQTTSTARTDELAY = 12 MQTTTURNOFFBLINK = 13 MQTTBLINKXTIMES = 14 MQTTSETTODEFAULTS = 15 MQTTREBOOT = 16 MQTTRESOLUTION = 17 MQTTERASEMEMORY = 18
from subprocess import check_output
def on_log(client, userdata, level, buf): print("log: ",buf)
# The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe("SKYCAM/+/INFO")
# The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): print(msg.topic) print(msg.payload) try: if (cameraID != ""): SplitTopic = msg.topic SplitTopic = SplitTopic.split("/") if (((SplitTopic[1] == cameraID) or (cameraID == "+")) and (SplitTopic[2] == "INFO")): myMessage = json.loads(msg.payload) if (myMessage["messagetype"] == "4"): # last INFO message - SkyCam only listens for a short while sendMessage(client, cameraID, sendWhatCommand) except: traceback.print_exc()
def sendMessage(client, cameraID, messageType): # send example command to SkyCameraRemote # send Blynk X Times # get msg topic MyTopic = "SKYCAM"+"/"+cameraID+"/"+"COMMANDS" # set up JSON myIP = check_output(['hostname', '-I']) myIP = myIP.decode() myIP = myIP.replace("\n","") myIP = myIP.replace(" ","")
print("sending messagetype %s to:%s " %( messageType, MyTopic )) # Commands:
if (messageType == MQTTBLINKXTIMES): # send blink message myMessage = { "messagetype": MQTTBLINKXTIMES, "myip": myIP, "length": 300, "count": 3 }
myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTCYCLECHANGE): # send time to sleep message myMessage = { "messagetype": MQTTCYCLECHANGE, "myip": myIP, "timetosleep": 170 }
myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTSTARTDELAY): # send time to wait for contrast adjust myMessage = { "messagetype": MQTTSTARTDELAY, "myip": myIP, "contrastdelay":1000 } myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTREBOOT): #reboot SkyCam myMessage = { "messagetype": MQTTREBOOT, "myip": myIP } myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTRESOLUTION): # set resolution myMessage = { "messagetype": MQTTRESOLUTION, "myip": myIP, "framesize":10 # set UXGA } myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTERASEMEMORY): # set resolution myMessage = { "messagetype": MQTTERASEMEMORY, "myip": myIP } myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
if (messageType == MQTTUPDATEPARAM): # update camera parameters myMessage = { "messagetype": MQTTUPDATEPARAM, "myip": myIP, "sensorparams": "0;0;0;0;1;1;0;1;0;0;300;1;0;0;0;1;1;1;0;0;1;0;" #"sensorparams": "0;0;0;0;1;1;0;1;0;0;300;1;0;0;0;1;1;1;0;0;1;1;" } myMessage = json.dumps(myMessage) client.publish(MyTopic, myMessage)
print("Messge Sent:",myMessage)
# main program
# what ID to test cameraID = "AAD1" #cameraID = "F329" #cameraID = "DE45" #cameraID = "26FD" #cameraID = "+" #sends to all cameras # this command will be sent after an INFO messagetype 4 from cameraID # sendWhatCommand = MQTTERASEMEMORY # sendWhatCommand = MQTTCYCLECHANGE # sendWhatCommand = MQTTRESOLUTION # sendWhatCommand = MQTTBLINKXTIMES # sendWhatCommand = MQTTUPDATEPARAM # sendWhatCommand = MQTTSTARTDELAY # sendWhatCommand = MQTTREBOOT
# client = mqtt.Client() client.on_log=on_log client.on_connect = on_connect client.on_message = on_message client.connect("localhost", port=1883)
# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting. client.loop_forever()
|
|
|
Post by doxidad on Dec 31, 2021 5:05:56 GMT -8
You don't have any commands selected to be sent. They are all commented out.
Uncomment this line. This will send the new resolution to be sent to the camera. The framesize is set to 10 in the code.
# this command will be sent after an INFO messagetype 4 from cameraID
# sendWhatCommand = MQTTERASEMEMORY # sendWhatCommand = MQTTCYCLECHANGE sendWhatCommand = MQTTRESOLUTION # sendWhatCommand = MQTTBLINKXTIMES # sendWhatCommand = MQTTUPDATEPARAM # sendWhatCommand = MQTTSTARTDELAY # sendWhatCommand = MQTTREBOOT
|
|
|
Post by bekaheni on Dec 31, 2021 7:47:36 GMT -8
Brilliant, and will that change it then to the cameras highest resolution ?
Cheers
|
|
|
Post by doxidad on Dec 31, 2021 9:31:05 GMT -8
Look on page 53 of the SkyCamAssemblyAndTestManual1.1.pdf for the resolutions available and the value to set in the code.
In the code change the value for the framesize. Then rerun the test program
if (messageType == MQTTRESOLUTION): # set resolution myMessage = { "messagetype": MQTTRESOLUTION, "myip": myIP, "framesize":10 # set UXGA <-----<<< set the value here for what resolution you desire. 10 = 1024x768 }
|
|
|
Post by SDL on Jan 3, 2022 9:30:36 GMT -8
You guys beat me to it! Exactly right. bekaheni, thanks for publishing all the code. Made it easy to figure out.
BP
|
|
|
Post by bekaheni on Jan 4, 2022 1:46:47 GMT -8
Cheers guys, worked a treat !
Ok last issue! Don't worry I have a work around!! My Camera seams out of focus, BUT! my fix is to take an old magnifying lens from glasses and stick it over the camera, work brilliantly.
But just wondering is there another way to focus the SkyCam camera ?
Cheers Nick
|
|
|
Post by SDL on Jan 4, 2022 14:07:51 GMT -8
Take the box apart and take a pair of pliers and you can turn the lens to focus the camera. It's tight, but it works.
BP
|
|
|
Post by bekaheni on Jan 5, 2022 3:04:47 GMT -8
Cheers, Will do that
|
|