Poey50
Well-Known Member
Oh. I solder those sizes...
I thought that was against the law in Lilliput.
Oh. I solder those sizes...
Well we could rehash the whole “solder is evil, thy shalt chrimp” line...
#!/usr/bin/env python3
import machine
import esp32
import boatymon
import uasyncio as asyncio
import uos
from machine import UART
uart = UART(1, tx=12, rx=14, timeout=50)
uart.init(baudrate=19200,bits=8,parity=None, invert=UART.INV_RX)
# # machine.UART(uart_num, tx=pin, rx=pin, stop=1, invert=UART.INV_TX | UART.INV_RX)
loop = asyncio.get_event_loop()
mySensors = boatymon.sensors()
import usocket as socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def sendudp(data):
address = ("192.168.43.74", 10111)
sock.sendto(data, address)
address = ("192.168.43.93", 10111)
sock.sendto(data, address)
async def call_sensors():
while True:
try:
mySensors.flashLed()
print("Looping")
except Exception as e:
print('error in call sensors function, error =',e)
pass
await asyncio.sleep(1)
async def check_wifi():
while True:
try:
mySensors.connectWifi()
except Exception as e:
print('check wifi error, error =',e)
pass
await asyncio.sleep(10)
async def fast_loop():
sreader = asyncio.StreamReader(uart)
while True:
try:
res = await sreader.readline()
sendudp(res)
res = res.decode("ASCII").rstrip()
values = res.split("\t")
except Exception as e:
print("Serial input decode error",e)
pass
loop.create_task(call_sensors())
loop.create_task(check_wifi())
loop.create_task(fast_loop())
loop.run_forever()
Thing is you end up with a hundred and one usb/serial adapters, ...... and yet more cables converging into the PiGHA, regarding this obsession you have for the ESPs, I think you need to see a specialist
Victron MPPT VE.Direct socket (old school CDROM audio socket btw) to a usbserial adapter and straight into a pi.
pi runs venus (as I guess yours does) signalk and all that jazz.
still learning but looks good.
about to embark in mosquitoing from the pi then over the internet to the server to write them to influxdb...
apparently the only way to throttle traffic properly!
V.
Thanks for that. Looks very neat.My whole project - except the CAD file for 3D printing which is coming later - is now up on GitHub. Poey50/Remot-a-boat.
Love your stuff @GHA.Not an arduino project to swap but esp32. Tonights fun was getting victron data into a Pi over wifi.
![]()
The ESP is 3.3v and the data coming out of the victron is 5v so it goes into an rs232/TTL adaptor which is powered by 3.3v from the esp so the TTL comes out at 3.3v. Not sure if that's how you're supposed to do it but it works. then the esp reads the data through a spare uart and sends it as UDP over wifi. After that there's a signalk app which reads the victron data and turns it into signalk. Shame the victron 5v out wasn't beefy enough to run the esp with wifi turned on, needed that little 12v/5v converter otherwise it would have been a right result
![]()
And of course once in signalk it all gets saved to a database automatically. Project for someone on jlcpcbWho will surface mount esp chips for you now apparently. Programmed in micropython which is pretty cool, you can access the esp over the web so upload or download direct from the device. Powerful little things!!
![]()
There's a basic class doing some wifi stuff as well, but the gist of it is below. Love python, it works and it makes sense. Shame the esp8266 doesn't have a spare uart input, would have been cheaper and less power though there may be a way to get serial data into an 8266. For another night
Python:#!/usr/bin/env python3 import machine import esp32 import boatymon import uasyncio as asyncio import uos from machine import UART uart = UART(1, tx=12, rx=14, timeout=50) uart.init(baudrate=19200,bits=8,parity=None, invert=UART.INV_RX) # # machine.UART(uart_num, tx=pin, rx=pin, stop=1, invert=UART.INV_TX | UART.INV_RX) loop = asyncio.get_event_loop() mySensors = boatymon.sensors() import usocket as socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def sendudp(data): address = ("192.168.43.74", 10111) sock.sendto(data, address) address = ("192.168.43.93", 10111) sock.sendto(data, address) async def call_sensors(): while True: try: mySensors.flashLed() print("Looping") except Exception as e: print('error in call sensors function, error =',e) pass await asyncio.sleep(1) async def check_wifi(): while True: try: mySensors.connectWifi() except Exception as e: print('check wifi error, error =',e) pass await asyncio.sleep(10) async def fast_loop(): sreader = asyncio.StreamReader(uart) while True: try: res = await sreader.readline() sendudp(res) res = res.decode("ASCII").rstrip() values = res.split("\t") except Exception as e: print("Serial input decode error",e) pass loop.create_task(call_sensors()) loop.create_task(check_wifi()) loop.create_task(fast_loop()) loop.run_forever()
Signalk app to write to cloud influxdb works!about to embark in mosquitoing from the pi then over the internet to the server to write them to influxdb...
apparently the only way to throttle traffic properly!
I'm sure you can do better than that! the parking sensors have a range of 20-40cm pretty sure about that! have a look, sounds like a fun project, deffo better than siting in front of the tv drinking and eating!My recent lockdown Arduino project, but nought to do with boats I’m afraid.
IR detector mounted on a servo, atop a 4 wheeled chassis. The aim was for a heat-seeking robot to annoy the cats. I came up with some really pleasing routines to scan, flag detection and then centroid track the “target”, plus a break-lock routine in case the target faded. Steering commands to the wheels for a pure-pursuit terminal engagement.
Unfortunately, it was as blind as a bat. I googled the spec for the IR sensor which revealed an optimum detect range of 3 to 5 cm. Yep, centimetres. So my heat-seeking robot is awesome at detecting a boiling kettle within about a foot and a half, but the cats sleep on...
Still it passed an evening or ten and all that fun for the price of about 40 boiled kettles.
Signalk app to write to cloud influxdb works!
![]()