1

Can anybody tell me which would be the fastets, best and easiest ways to somehow run python scripts on my raspberry from my android phone. I tried via ssh but it never worked. Bluetooth connection would be also okay, but I couldn't find a good how-to for that.

Thanks for your replies.

johnny cigar
  • 119
  • 10

1 Answers1

0

So which wasn't working? The ssh or running the scripts? Do you have the scripts made already or are you changing them using the phone? If you have the scripts stored on the rpi you could run them over the SSH using commands like:

python script.py

personally I use JuiceSSH for connecting to raspberry pi from my cellphone. You either need to be on the same network or setup somekind of a dynamic dns service to connect over the network. I have used successfully No-Ip on my rpi to this purpose.

edit: what are you trying to achieve with the scripts?

Pekafu
  • 35
  • 1
  • 12
  • Thanks for the quick answer and mentioning JuiceSSH. The process will be the following: Start my app, push a button which runs the python script on the raspberry pi, that script generates a file, which file has to be sent back to my phone. Can I solve that directly in the python script that sends back the generated file or do I have to use some cloud storage like onedrive or google drive? – johnny cigar Jul 04 '17 at 14:45
  • You could try to make scripts so that the at the end it calls for scp-transfer: scp -P 2222 file root@SSHDroid-ip:/mnt/copypath/file – Pekafu Jul 05 '17 at 06:50
  • Thanks for the answer. I think that your method would be the easiest and the quickest. I tried to send file via bluetooth, but it was really slow. Uploading and downloading from cloud drive was faster but hopefully the process you wrote would be faster. The only thing I'm not sure about is this: scp -P 2222 home/pi/dark.jpg ?>@192.168.x.x4:/mnt/sdcard/bluetooth/sent_dark.jpg What should be the root (of my android device) instead of the ?> before @? Thanks. ps: 192.168.x.x4 is my android device's ip address. – johnny cigar Jul 10 '17 at 09:57
  • I think you need also a SSH server on your phone I tried "SSH server" from Googlestore. It seemed quite easy to setup. Couldn't transfer data from my pc to the phone because of some permission error. You could try to figure out that permission thing. I'll be off to a vacation for few weeks so I don't have currently time for checking it. – Pekafu Jul 13 '17 at 12:57
  • Thanks, but as hopefully other users will use my application and it'll be likely they don't have any other application (like SSHDroid) downloaded only mine. Do you have an advice what i can use instead of SSH/SCP? – johnny cigar Jul 13 '17 at 13:27
  • I don't know how hard it would be building a SSH server inside the app itself, but that could also be an option. When it comes to other options I don't know what would be best one. Perhaps hosting a FTP server on the Raspberry pi and copying file from there using your app when the rpi gives a response that the file is ready. – Pekafu Jul 14 '17 at 09:50