Thread Rating:
  • 0 Vote(s) - 0 Average
WiFi Usb flash drive (WIP)
#1
The final scope is to remotely sent files to my Elegoo Mars 3D printer with the help of raspberry pi zero w board. (WIP)

Similar to The MagPi magazine's article the owner of photon printer (Will Koone) make a ready to use image file that can be found here
(https://drive.google.com/file/d/1sh5zXyo...QXdAzlZ43N)

I use Windows 7, and Putty to communicate with Pi. You need also one program to write the image to the microSD (like Etcher from Balena) and your favorite text editor (like Notepad++). It handy to have also an Ip scanner (like ipscan24) to find the IP of your pi.

original info pages:
https://magpi.raspberrypi.org/articles/p...lash-drive
https://www.facebook.com/groups/Anycubic...765643826/)

>Make WiFi USB flash drive 

- Write the img to microSD (minimum SD size 4GB suggested size is 16GB)
- After finish, load again the SD and add two text files 'ssh' (without extension!!!) and 'wpa_supplicant.conf' (.conf !!!) inside the second one enter your wifi data (SSID-password). You can google the filename for sample (also I have add sample files).
- Remove the SD from computer and put it to the pi zero and power up it from power port.
- After pi boots (you can check the green light became steady on), run the ipscan24 to find the ip of the pi. If you can't find check again the data in wpa_supplicant.conf (when pi boots it delete the two extra files)
- run Putty and enter the ip of pi to make ssh connection. Default name will be pi and the password is raspberry. You don't need to change that if you have secure WiFi network at home.
-If all went ok so far, at windows Network you can see a new computer with name 'RASPBERRYPI' and with shared folder named 'usb'. This is the folder that we will sent the files to the printer.
- Because the initial folder space is the minimum (512MB) in order to fit the image to 4GB SD, you can run this command at the terminal (with putty)

sudo rm /photon.bin
sudo dd bs=1M if=/dev/zero of=/photon.bin count=8192
(NOTE: this will take some minutes to finish, don't power down the pi)
sudo mkdosfs /photon.bin -F 32 -I
sudo reboot now

(2048=2G, 4096=4G, 8192=8G and so on) Make sure you leave room for the OS.

Please note that after any reboot or halt the ssh connection with the putty is lost and you must start over.


>Connection with the Elegoo Mars:
Although in my laptop the pi zero working ok when connecting it with the 2nd usb port (NOT the power port) in my 3D printer there is problem with power. It cycles power on/off before pi zero loads properly. I have the newer board (w/o Lan port) and in info screen it says ChiTu L5.5 Series, Version v4.3.1
My temporary solution was 1st to power the pi zero with external power bank using the power port. After pi boots, I have connect the usb data cable to Elegoo Mars but with cutted (!!!) the red cable so do not pass power from my battery, back to my printer's board. Then I can normally see my files. 2nd solution: I also make a custom Y cable. One side with male USB and two female USB in parallel connection. Then FIRST power up the pi zero from the power port. AFTER boot ends (normally after couple seconds) THEN I connect the other USB cable to the data port of Pi Zero. After that I can see the files of shared folder. The drawback in this solution is that you have to disconnect the data cable after power off the printer. I need work with that....

>power on/off button:
adding a momentary switch to pins 5-6. It is safer to power down properly the pi zero, because you may have problems with the SD or worse with the board it self.

thru ssh (putty) run the command
curl https://pie.8bitjunkie.net/shutdown/setup-shutdown.sh | bash

after finished you must to edit the rc.local file
sudo nano /etc/rc.local
And right above 'exit 0' (last line) you must add the command:
sudo python /home/pi/scripts/shutdown.py &

Exit editor (Ctrl+X and choose Yes and press Enter, to save without change the filename)
sudo reboot

Original info at pages:
https://pie.8bitjunkie.net/retropie-shut...e-easy-way
https://www.dexterindustries.com/howto/r...t-startup/

>adding indicator led:
add a led between pins 6-8 with a resistor of about 300 Ohms for security. Pin 6 is our common negative pin so we use total 3 pins

connect the SD to computer and edit the file config.txt adding at the end the line
enable_uart=1

Original info at:
https://howchoo.com/g/ytzjyzy4m2e/build-...-indicator

This solution it cost to me about 16 euros for the pi board with the case. The rest are from salvage stuff.


Attached Files
.zip   sample_files.zip (Size: 408 bytes / Downloads: 28)
Reply
#2
hello, I have done what you have said, the PI ZERO is now working fine as a USB disk on my computer, on my TV SetupBox and same on my 3D printer.
BUT I can't do it using wifi...
I see the IP address from my PI ZERO on my internet box settings and a wifi is established. When I ping the IP adress, no respond. Same with Putty software... it says there is no Route...
When I plug it back to my computer, I can't change anything fas I can't edit the raspi-config. I have tried to connect it with WinSCP, same... not able to reach my PI ZERO IP adress...
Anyone has en idea ?
Actualy the only thing I can do is to copy my print file to my PI ZERO connected to windows and then plug it to my 3D printer and then print... well, that's how a regular USB is working... Purpose is to transfert file using wifi...
Reply
#3
Hey there,

did it with an self soldered usb Y-Cable, wifi & Samba is working but Mars Pro didn't recognize the USB,

at my Laptop everything is working fine.

Do you have an Idea?


thanks Smile
Reply
#4
I am in the same situation as martinronz.

I ran through the setup demer listed here:
https://magpi.raspberrypi.org/articles/p...lash-drive

I had to make two modifications to make it work:
-Per Steve_W's comment on that article, "the line that says 'ExecStart=/usr/local/share/usb_share.py' should read 'ExecStart=/usr/local/share/usbshare.py' to work properly"
-Additionally, I could not get it to work without changing 'modprobe g_mass_storage file=/piusb.bin stall=0 ro=1' to 'modprobe g_multi file=/piusb.bin stall=0 removable=1' in the python script you download (See here for more details on that: https://raspberrypi.stackexchange.com/qu...sing-g-mas)

It now seems to work perfectly when connected to a variety of windows machines, but simply won't show up when connected to the Mars.
-I've tried a variety of combination of powering it externally, solely off the printer, etc. It seems most effective to use a data cable in the USB port with the red/voltage line removed, and power it separately via the PWR port.
-I've confirmed that it shows up as a FAT32 partition when connected to a Windows machine.

I have a brand new Mars, so it likely has the new board in it.
The software version reads: V4.3.2_LCDF /1440x2560 /F2.13

If anyone has had success getting past that point, please let us know.
It's a bummer to be so close, but not be able to get it to work.



Edit: Using the image linked in this video worked for me:
https://www.youtube.com/watch?v=gXpz9ovCS1w&t=310s

I'm not sure in what manner it differs from the rasbpi.org guide, but it functions as expected.
I expanded the size of the bin per the instructions in the video description (to 4GB).
If others are stuck here, consider trying this!
Reply
#5
Has anyone gotten this to work on the new Mars 2 Pro? I've gone thru about a dozen variations but will not work. I can see the shared usb from my computers but not the printer itself.
Reply
#6
[Image: pi78oaKdT.png]
Reply
#7
has anyone got this to work 100%

I see where people get it to work on there pc but
have you tried to copy to it wirelessly and see if the files show up on the Drive letter create by the usb connection

I can copy files to it via usb or via wireless but neither side can see the files that I copied from their opposite without rebooting the unit
anyone else test this
Reply
#8
Sadly I gave up and just bought a bunch of USB drives.
Reply
#9
I know this is an old thread but I was able to get this working for my Saturn 2 after making the changes mentioned above by Martin to the original MagPi guide, and by commenting out the "otg_mode=1" line in /boot/config.txt.

Above that line in the config.txt reads the following:
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.

So it appears that this needs to be disabled for dwc2 to work with the latest Rasberry Pi OS version. (I'm using the lite version.)

For automatic changes, I also tweaked the timeout variables in the usbshare.py script. Making the timeout shorter, since I'm likely only moving one file at a time anyways, and by making the reset time between the dismounting and remounting commands a bit longer.

One other notable difference with my setup is that I am handling auto-starting of the script using the following line in the sudo users crontab.
@reboot sudo python3 /usr/local/share/usbshare.py &


I just got it working earlier today, but I have done a decent amount of testing and it appears to be working pretty consistently for transferring .ctb files directly to my printer over the wifi.

Just wanted to share my experience. Hopefully, someone finds it helpful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)