|
Forum Index : Microcontroller and PC projects : Bryans Car Club Record Project
| Page 1 of 2 |
|||||
| Author | Message | ||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
G'day Guy's, Well it is time to start my own thread and I'm using several pico 3 computers all working together so the first thing to do was setup the snd.py and recv.py files which handles the wifi between the boards so here is the code For the PICO1 send.py >>> cat("send.py") import socket, os p = '/sd/1.jpg' n = os.stat(p)[6] s = socket.socket() s.connect(('192.168.4.16', 6001)) s.write('back.jpg,' + str(n) + '\n') f = open(p, 'rb') g = 0 while True: b = f.read(1024) if not b: break s.write(b) g = g + len(b) f.close() s.close() print('sent', g) >>> Now the recv.py >>> cat("recv.py") import socket s = socket.socket() s.bind(('0.0.0.0', 6001)) s.listen(1) c, a = s.accept() h = c.readline().decode().strip().split(',') n = int(h[1]) f = open('/sd/' + h[0], 'wb') g = 0 while g < n: b = c.read(1024) if not b: break f.write(b) g = g + len(b) f.close() c.close() s.close() print('got', g, 'of', n) Now for PICO2 the send.py >>> cat("send.py") import socket, os p = '/sd/cars/1.jpg' n = os.stat(p)[6] s = socket.socket() s.connect(('192.168.4.1', 6001)) s.write('1.jpg,' + str(n) + '\n') f = open(p, 'rb') g = 0 while True: b = f.read(1024) if not b: break s.write(b) g = g + len(b) f.close() s.close() print('sent', g) For the recv.py >>> cat("recv.py") import socket s = socket.socket() s.bind(('0.0.0.0', 6001)) s.listen(1) c, a = s.accept() h = c.readline().decode().strip().split(',') n = int(h[1]) f = open('/sd/' + h[0], 'wb') g = 0 while g < n: b = c.read(1024) if not b: break f.write(b) g = g + len(b) f.close() c.close() s.close() print('got', g, 'of', n) Now in our main.py >>> cat("main.py") import network ap = network.WLAN(network.AP_IF) ap.config(essid='pico1', password='pico1234') ap.active(True) synctime() for the pico2 >>> cat("main.py") import time time.sleep(6) wifi('pico1', 'pico1234') >>> This what I used to transfer a 440Kb file first via teraterm which was corrupt so setup my SDCard reader and putting the .py files on was easy. Now I did setup to the hotspot on my phone and left it going when we did the file transfer and the phone showed 0 data so the wifi just worked. Now the file was 1.jpg which is a jpg file I got off the club page which is a car photo, now got the error progressive jpg files not supported so although the picture didn't show transferring it did. Now after a day with Claude this what it had to say.... Sounds good. If it's useful for the writeup, the summary of where things landed: two Pico Computer 3 boards, one as AP and one as client, both coming up connected at boot with no intervention; TCP file transfer working both ways with a 441 KB JPEG as the test; and a SQLite-backed club system with member, cars and events pages on the HDMI GUI. The AP-mode finding might be the most useful thing for other people there — it fails consistently if you reconfigure the interfaces live, and works reliably when each board sets its role once at boot from main.py. That cost us most of a morning and isn't in the manual. Now what we came up for Day 1 club.zip Now doing a ls("/sd") >>> ls("/sd") <dir> 2024-12-06 10:22 Camera <dir> 2026-08-01 16:21 events <dir> 2025-09-01 16:02 Games <dir> 2026-08-01 12:55 members <dir> 2024-10-09 16:43 Music <dir> 2025-09-02 11:13 Programs <dir> 2025-08-26 09:06 System Volume Information 440973 2026-08-01 11:21 1.jpg 1948 2026-07-22 15:34 car_meet.py 2051 2026-07-22 10:07 car_meet.txt 11283 2026-07-25 11:14 carclub.py 45056 2026-08-01 16:50 club.db 23625 2026-08-01 16:50 club.py 5654 2026-08-01 17:20 club.zip 1688 2026-07-25 23:43 import_members.py 4748 2026-07-25 23:43 main.py 189 2026-07-23 15:18 members.csv 126 2026-07-23 15:18 members.csv.bak 8192 2026-08-01 16:31 members.db 7011 2026-08-01 14:39 members.py 2915 2026-08-01 04:35 menu.py 42 2026-08-01 13:26 roles.txt 18 2026-08-01 13:26 status.txt we can see the club.py file is at 23Kb and best of the club.db file is 45Kb and once I did that this what Claude said It's there — 23,625 bytes, timestamped 16:50. The 3456 figure was from the earlier listing before the transfer. Better still: club.db exists at 45,056 bytes, same timestamp. So you've already run it and SQLite created the database with all five tables. That's the whole thing working. Slight size difference from my 22,960 — probably line-ending conversion during the transfer, which is harmless for Python So now decision is do I work on this tomorrow or go on a car meet drive to Lamaroo to play golf and get closet to the hole. I haven't taken my 1996 C200 Mercedes out since I transferred it over to historic rego. Regards Bryan Edited 2026-08-01 18:01 by Bryan1 |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well progressing slowly and getting there Now I have a 3 files, menu.py club.py and members.py now when menu.py is loaded clicking on any link box the pico does a reset then loads the page so not sure why it's doing that also when clicking the link to get back to menu.py it does a reset. Hopefully Claude can sort that out today. Trying to explain how I want the text box's changed to Claude was very frustrating so this morning I will go thru and have a read of the code and do it myself then I can have a look first hand and see how the program is structured. I do need to edit the send/recv .py's as now it's setup to transfer any file both ways Also setup a wifi connection page and when a users eesid and password is entered the * is shown for security on the password, connecting to my mobile worked first time So this jpg image problem will be on the cards to fix today so I can load all the cars on the facebook club page then when a volunteer has a look they can sort the car images out to go in each members page. Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
ok leaps and bounds this morning fixed the issue of resets and the code has now gone upto 48Kb Now with the wifi going if a member points their browser to 10.108.72.47:8080 they can see the photo upload page |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4377 |
That's a private IP address, isn't it? John |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
thats the IP address of board 2 and I pointed to that IP on my phone today and uploaded 2 pictures I took of my car. Once the pic was taken a prompt came up to save then on the webpage got to remove the 20 numbers that the mobile gave the JPG file and saved it as Bryan7.jpg. About a minute later that webpage said upload complete and the photo page showed the new entry. I clicked on the file then clicked the show pic button then got a full screen picture on the HDMI. Now the incoming file is 5-6MB and the code resizes the picture down to 400KB while retaining full picture quality. |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well another good day's work on this project got it setup now when the pico 3 starts the wifi connects then boots straight into club.py and setup a Export/Import page where the SD card is shown so files can imported and exported.Now clicking on ALL Members then Export takes 2 clicks and the ticker displays all the infomation then it makes a time stamped CSV file. There is a box where the IP of the other boards is put in then click send and it will show whether the file sent or failed. On the second board opening Export/ Import then clicking refresh will show the file and a double click on Import then the file is inserted into the code. Got Claude to make a 100 member list so we could test it all out and sure enough board 2 had that 100 member file where it showed on the member page. As we now have 100 with the listbox just poit the mouse click and move up and down the list. Now where Claude is having fun NOT is with jpg images that are imported by a mobile phone. As the mobile will add a 20 digit number as the file name on the webpage is a box where the filename can be saved then click upload and a minute or 2 later the file comes up in the photo page. He setup a full screen view where once the image is loaded it stays there for 5 seconds then reverts back to the photo page but the images are too grainy and it does need to be better.After tomorrows effort I will zip up club.py as honestly currently at 90KB a bit too big to put between Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Ok Guy's finally ready to release V.20 with a total new club.py so all my details are not made public. The last thing I did today was put in a help file system so the whole program can be understood. For testing out the building of this code I used 2 PICO 3 boards and now got when an entry is saved all other boards are updated. This does require a wifi connection to work between boards where the wifi page does all the connections. Also is a ticker tape which shows what is going on which I have found very handy debugging. Anyway this is built on SQL lite so guy's have a look and most of all the feedback is important as were are getting close to my club demonstration on the 3rd Tuesday of this month. club.zip Regards Bryan Edited 2026-08-06 18:23 by Bryan1 |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Edit: Now what I am finding with with Board 2 is my mouse wifi USB doesn't start and pulling it out does get it going now it is freezing at times but it may be its on the way out but using the same mouse on board 1 it does work fine. Tomorrow I will load up V0.14 and see if this persists on another new board to see if the problem is still there. |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Finally switched over to code with Claude so now got my own GitHub Now I had a read of the GPS manual so got 3 GPS modules coming from Core Electronics which should be here next week. Now as it was only yesterday I read about astro stuff how good is it when it's going as I gotta find a few things for the volunteers to do on the quiet times. Now got a standard and scientific calculator page and slowly working on a 3D Model Editor. Tomorrow this code gets it first look from someone else as I'm taking one board over to Sam tomorrow as my first 3D printed box should be done. Regards Bryan Edited 2026-08-08 17:38 by Bryan1 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11815 |
Bryan, check if the hub chip is getting hot. If it is make the mod I posted on the board thread |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
I will give it a quick test in the morning before I take the board over to see Sam and I did find just taking the dongle out of the usb and re-inserting it back in got the mouse working. Now on bootup it does show the mouse is connected so not sure what is going on anyway got Claude on my desktop now so it can have a look and see what is going on. I do have to say this car club project is moving along at a rapid pace and it's starting to become a solid OS on every software update and there was few everytime each board connected to wifi on boot then opening the wifi page saw they were both connected on the network. Doing a 1 letter edit and pressing save then update saw the changes on the other board straight away.Also I will test the other 3 boards and see if the USB problem is there or not, now I did get an email saying a couple of boards had some yellowing and I had to give the OK for them to ship so I will have a look with my microscope and see if anything is a miss. Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well gotta say Sam was impressed with what I have done and one thing he did see before we even put a eesid and password in a pico2 was showing up on his wifi list setup the wifi and found it wouldn't work on 5G so the 2.4G was switched on and soon enough the board was on wifi So pointed Sam to the ip address shown and the webpage came up so now got a kitty pic and gotta say 10 seconds after the send button it was showing in the files list also for the first time tried a keyboard/mouse wireless keyboard and it worked with no problems and this was the same board I fun with the mouse with so I don't think it's hardware related. Regards Bryan |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3374 |
|
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
A keyboard/mouse just worked at Sams today for an IT guy he was impressed so now I have a kitty picture in photos this club.py is coming of age to be my new OS I go too I am on making a a 3D Model Editor in club.py as what I'm doing today can really update it noe when I get to a stage of release it will be on my github or club.zip Claude stripped out most of my creds and on the pico3 it is an OS so try it and give feedback as it is a rock solid SPI machine Now today's Claude lets make a 3D Model Editor within club, got all 3 axis sorted but go and test it as I do think I have a dead mouse. Got a laptop and PC today with fresh win 10 on both now with a clean install I'm sure the old history will die. But with 5 off pico 3 boards and Claude can modern software become out dated as each can become and a new family member of this micro-pyhon crowd OS as we make like it should be. Let Dad make the situation program in the kids but now us old beggers found AI now was this call late as I am an old school Fitter/Machinist that just found something back in '03 to saying rules my day. Anyway todays work a 3D Model Editor it was emeebed on club.py but dug it out so have a look and ask Claude to improve it as this is open source where one can make a .model file that when we get data we know what what to do maks .sSTL file or a G-code file and work out the steps needed. so here is the source Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well Guy's I did get confirmation where I can do the presentation of club.py at the car club meeting tonight where I'm going to offer 2 boards where members can take home to really road test this idea out.Now talking with my sister who is in Rotary and she sets up the podiums she did confirm it is HDMI driven so there is a good chance I can get a board to work where the full screen is shown so all members can see the screen. For me always being a quiet guy who likes to keep to myself this project has brought me out of my shell where hopefully all my hard work will pay off A huge thanks to Peter for forking Micro-Python to the PICO 3 as it has been an eye opening journey to this point which I do believe can only get better. Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well that was an eventful evening at the car club, decided to use the keyboard and mouse off my linux box untested of course so of course it didn't work at all, although on boot it did show mouse and keyboard when club.py booted with no mouse taking it out and putting it back in again failed so one board was just turned off. Now talking with the committee after the meeting the question was asked can any member come in and change settings so a new login page is going to be made and if noting is done within a preset time it's going to a screensaver and a relogin will be required. Also financials will also be added and mass email/text functions will be made so once an event or fees are due one click can send the message. So the whole shebang of club.py is getting a new face so I will spend some time in Inkscape making new icons and get rid of the box feeling with the whole setup. Now a valid question to ask as micro-python can only do 16 colours does MMBasic do more so a picture quality worthy of a photo can be had. If so this whole project is going back to MMBasic. Regards Bryan |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11815 |
Micropython has better colour than MMBasic RGB640 640×480 RGB332, 1 B/px 256, fixed fixed 8R×8G×4B grid RGB320_8 320×240 (doubled) RGB332 256, fixed same fixed grid RGB320 320×240 (doubled) RGB565, 2 B/px 65,536 32R×64G×32B RGB512 512×300 (doubled) RGB565 65,536 32R×64G×32B RGB1024 1024×600 native RGB121, 2 px/B 16, palette 256 (see below) RGB640_4 640×480 RGB121 16, palette 256 |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well that was a fun day today working on club.py now got a login screen where a screensaver is shown that does need some work, setup a financial page also a excell template where all the data can be used. Now text messaging did take several hours to get going after claude went on a dead end path so I said as the wifi is going thru a mobile hotspot why not use that which gave him something to think about. Now had to download an app where my android phone went into meltdown saying this app could harm your phone etc and refused to let it work. I got it to do a write up so the next person doesn't have the same problem too. So I found today just how to get into into developer mode which goes find the build date in 'about' then click on it 7 times and enter yes. This gave claude access where it tried and failed so it found a work around. Turn off play protect then go thru the motions setting up the app then tried sending a text message to my phone and next thing the phone beeped saying I had a message We did try other resoutions which plainly broke the code so reverted back to what we were using. Last thing today was setting up a email page where the user can write a email which needs more work and the ability to attach files. claudes soothing green is getting a big revamp so still plenty of work to do but most of all having fun. Regards Bryan |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well decided to be bold on Saturday morning and asked Claude well my historic C200 merc has a few problems so wouldn't it be good if we could hack it so we can read the codes and turn club.py into a ECU reader for older cars Half an hour later it was written into club.pb where I can just use pin 4 on the 38 pin connector and pin 1 for ground. Pin 4 is the K-Line for Mercedes comms on pre OBD2 days. Now I had a bbq to go to so it all got left and after a bit of fun along with 1/2 a bottle of my moonshine come Monday trying to workout a circuit from claudes net lists was fun but got there. So with 2off npn's, a diode and 5 resistors got RX/TX comms in one line. It did check my sprint layout circuit where I had one error so got all that fixed and tomorrow the board will go off to jlcpcb to get made. As club.py can now be a ECU reader a portable solution is needed so got on and bought a 10" HDMI touch screen where the touch is micro usb. Now claude has said well MMBasic has got USB HID builtin micro-python doesn't so my comment as I want a USB stick to be used for exporting data we may just have to make a USB HID for micro-python. Anyway when that screen does get here I will be testing the touch out and if we need the drivers they will get made. Regards Bryan Edited 2026-08-24 17:25 by Bryan1 |
||||
Bryan1![]() Guru Joined: 22/02/2006 Location: AustraliaPosts: 2247 |
Well that 10.1" IPS touch screen turned up this morning now as it does have 4 screwed holes which did come with the screws and spacer so mounted a pico3 on the back and got the cables nicely tucked away.So got it all setup with claude and updated club.py and flashed my lastest firmware. What surprised me the touch screen just worked and on a reboot USB-Touch is mounted, the setup did connect straight up the BT and using the music player page clicked on "Stairway to Heaven" and it started playing on the Flip Just had to take a picture using the website link of the IP and 3 minutes later opened the large picture and it opened with close to picture quality but some refinement is needed. So the next thing to add as we have plenty of in/outs is one of those new cameras and design up a new 3D box to hold the camera, GPS and OBD-11 connector which should be enough one does think. Regards Bryan |
||||
| Page 1 of 2 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |