seventz
Posts: 3
Joined: Fri Aug 05, 2022 1:49 pm

Pico W - send file to server over WiFi

Fri Aug 05, 2022 2:01 pm

Hello, everyone!
I am getting into raspberry microcontrollers and I found the new Pico W very interesting - the WiFi capability opens a lot of possibilities.
I want to connect a camera to the Pico as described here: https://www.arducam.com/docs/pico/arduc ... y-pi-pico/
My goal is to make the camera take pictures and save them on a local network server location. The biggest hurdle is the last part - saving the file on server.
I know how to connect Pico W to WiFi connect-raspberry-pi-pico-w-to-the-internet
I know how to create a network-shared server location on a Windows PC https://pythonprogramming.altervista.or ... 3037109375
But how to save a file on the server? I cannot find an answer anywhere.
If any of you could give me a hint, I would be extremely grateful!

foxsquirrel
Posts: 101
Joined: Thu Dec 30, 2021 2:56 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 2:09 am

My suggestion would be to get

ISBN: 9781871962680

Programming Raspberry pi pico in C.

Back of the book is a section on setting a up a server. That will get you started.

Its best to get the information from a book, internet information is mostly trash, its geared toward luring in people to get clicks. If the site is not monetized (click ads) then the info might be useful to you. Also those with monetized sites copy from others so the same useless code is on who knows how many websites. They don't care because it makes them money and you burn up your time.

Also, if the server is connected to the internet be careful with what you are doing. It would be best to set up the system and get it running while air-gapped from the internet.

seventz
Posts: 3
Joined: Fri Aug 05, 2022 1:49 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 12:04 pm

Hi, @foxsquirrel
Thank you for your reply! Sure, I will take care of the security - it all should work on the local network only.
But I am not sure if you understood me well. It is not my goal to set up the server on the Pico. I want Pico to access another location on the local network that I'm referring to as "server", so the Pico would be the client, if that makes sense. I am just looking for a way (code) to do the following on the Pico:
Assuming I already have a file on Pico, say file.jpg, save file.jpg in the given folder on the network location.

foxsquirrel
Posts: 101
Joined: Thu Dec 30, 2021 2:56 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 2:26 pm

seventz wrote:It is not my goal to set up the server on the Pico.
Yes, its all interrelated and to have success you will need to understand client and server.

If you can work through the example and get it working AND understand every line you should be able to set up what you are planning on doing.

If you stay linux server with possibly apache2 running it will be much simpler to develop. It would also help if you understand BASH shell scripting, many times for simple projects a shell script might be the best way to go or python and maybe some C.

Its pretty safe to say that you will have go on the adventure by your self, when you get stuck in a specific area just reach out for some assistance.

Just some simple file transfer might be what you are looking for and that would drop the level of complexity immensely. We did not get very deep in the Pico so I don't have a clue exactly what it can handle. Unfortunately I had to drop the project because of a uart issue that is centric to the design. Now the pico stuff is at my home office until it gets sorted out, if and when it does we will be doing networking with the device.

User avatar
neilgl
Posts: 4682
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 3:07 pm

I think OP is looking for ideas that work, not “ I don't have a clue exactly what it can handle” ?

ame
Posts: 5408
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 3:10 pm

Hmm. What can I put here?

foxsquirrel
Posts: 101
Joined: Thu Dec 30, 2021 2:56 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 4:13 pm

[/quote]
neilgl wrote:
Sat Aug 06, 2022 3:07 pm
I think OP is looking for ideas that work, not “ I don't have a clue exactly what it can handle” ?
And what might that be?

So far I cannot get out of the gate with pico. Found the first issue with the uart now I found a second one. I am hoping its just a some kind of a ground loop or some other current flow that is locking up the USB boot loader when a level convertor is connected to physical pins 1&2 (uart0). It is on a bread board so it might very will be the test setup that is causing the issue. So, when we need the uarts and the device is flaky is it something to spend more time with and hope other issues don't emerge?

I have to physically remove the usb level convertor from the host so the usb boot loader works......

alastairpatrick
Posts: 270
Joined: Fri Apr 22, 2022 1:39 am
Location: USA

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 4:35 pm

I believe LWIP - the library that Pico W uses for wifi and networking - supports the Trivial File Transfer Protocol (TFTP). One solution might be to run a TFTP server on the Windows PC and have the Pico W be a TFTP client.

Another option might be to use the HTTP protocol instead. In that case, you could write an HTTP server with node.js or similar and run it on the PC and the Pico W could be the HTTP client.

If you don't want to run any special software on the PC, I think that would be difficult but not impossible. The software that Linux computers use to connect to Windows shared directories is called Samba. You could potentially use that as a basis for writing something similar for Pico W.

I haven't done anything with Pico W yet so I'm not particularly confident about any of this.

User avatar
neilgl
Posts: 4682
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 5:22 pm

Uart0 and uart1 are working fine for me, connected to a pi4 or another pico. Have you got a separate thread about it.?
Also, MicroPython on the pico includes usockets, so that may be a way forward. The usual python3 ftplib does not seem to be supported in MicroPython
I might try that github ftplib but that may need a manual install…

foxsquirrel
Posts: 101
Joined: Thu Dec 30, 2021 2:56 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 11:31 pm

neilgl wrote:Have you got a separate thread about it.?
Yes, someone was helping me with with some code that is known to work. That did not work until the picoprobe was disconnected from uart 0. Then using usb boot loaded the code and uart1 started to rx data.

Its just below this one titled:

Does uart1 actually rx data while using usb and uart0 because it does not work. ?




My apologies to OP for going OT on this, my issue(s) have a different thread running.

seventz
Posts: 3
Joined: Fri Aug 05, 2022 1:49 pm

Re: Pico W - send file to server over WiFi

Sat Aug 06, 2022 11:58 pm

Dear all
Many thanks for your replies, your time and effort!
Sorry for not being not exactly clear in what I needed - it's true I have been looking for some ideas. The idea of FTP client on Pico and FTP server on Pi or a PC looks good to me, especially that there are micropython libs for it! I may also try the trivial file transfer. I will update here when/if I get it working.
Cheers!

Return to “General”