Help Please: Connecting with/updating Raspberry Pi Python script.

Discussion in 'Other CPUs and chipsets' started by jars121, Jun 16, 2013.

  1. jars121

    jars121 Member

    Joined:
    Mar 6, 2008
    Messages:
    1,787
    Location:
    Sydney
    Evening all. Absolute Pi nwb here, so be gentle :)

    I have experience with Arduinos, and I love being able to work on a sketch on my desktop/laptop, then compile and upload the sketch to the Arduino via Bluetooth/USB etc.

    Given that the programs running via a Raspberry Pi are contained within the Pi OS, I'm guessing this isn't an option? Furthermore, if I wanted to work on a particular Python program for the Pi, I'd have to physically connect the Pi up to KVM?

    My Pi boxes are going to be running in an industrial environment, where I won't be able to take a KVM to update the Python scripts. I'm looking at getting a rugged tablet or similar, that I could maybe plug the SD card into, make the changes to the script, then plug the SD card back into the Pi.

    However, as the script file will be contained in the OS, I don't think I'd be able to see the file when viewing the SD as a mass storage device? Anyone have any idea as to what I'm rambling on about?
     
  2. FalconGT

    FalconGT Member

    Joined:
    Jul 1, 2001
    Messages:
    1,538
    Location:
    Ballina
    You don't need to have it connected to a monitor.

    Just chuck it on the network somewhere and access the pi it via ssh.

    From there you can program / run the python script as if you were sitting behind a monitor connected to the pi.

    If there's no network, you could just chuck it on a usb stick and copy it across. There are lots of ways to achieve what you want, just need to be a little more specific.
     
    Last edited: Jun 16, 2013
  3. OP
    OP
    jars121

    jars121 Member

    Joined:
    Mar 6, 2008
    Messages:
    1,787
    Location:
    Sydney
    Ahh legend, thanks for that. The reason I ask is because each of the RPI's will be in a locked container in the workshop, so I'm trying to avoid physically accessing the USB ports. I had planned on adding a WiFi dongle to them to output to the network, so the SSH idea looks like a good option. I have never used SSH, so might have to do some reading up on it.
     
  4. IzzehO

    IzzehO Member

    Joined:
    Mar 9, 2011
    Messages:
    936
    Location:
    4152
    I uhhhh.... don't really know where to start with this...

    I'll try to keep this in mind.

    Your first mistake is confusing an ARM based computer with a micro-controller dev board. Entirely different things. The Pi is far more comparable to (and in fact is more-or-less the same as) your run of the mill computer. It has an operating system with a file system, applications, inputs and outputs, networking like any other. Any program program you write is going to execute like any other.

    I'm quite lost with what you're saying here, my best guess is you're again comparing a Pi to an Arduino. What you say couldn't be further from the truth. If you're writing

    There are many, many other options (most of which would be much better than a KVM anyway). I'll just list a few.

    If you have network access to the best:
    • SSH gives you terminal access, which should be more than enough to add a few changes and/or upload a new script.
    • VNC/RDP for connection from a regular laptop/desktop.
    • FTP server. Just drag and drop the new script (and have a second script reloading it every now and then).

    If you don't:
    • Any of the above, just connect directly to the ethernet port with a laptop.
    • Connect a usb stick with updated program and have a script on RPi automatically copy it off.

    You're happy to spend upward of a grand on a tablet for access to a $40 device? That's a little non-sensical.

    Quite easy. Just don't access it from a windows PC (or patch it so it can see ext3/4) and it'll show up like any other mass storage.
     
  5. FalconGT

    FalconGT Member

    Joined:
    Jul 1, 2001
    Messages:
    1,538
    Location:
    Ballina
    Adding a wifi dongle will be a good option :)

    SSH is awesome .. learn to love it and use it.

    Grab PUTTY if you're using Windows.
    If you're using an Android tablet (or phone), try JuiceSSH

    How many of these you plan on deploying?

    I ask as you may want to consider having some sort of update mechanism without having to manually connect to each one.
     
    Last edited: Jun 16, 2013
  6. OP
    OP
    jars121

    jars121 Member

    Joined:
    Mar 6, 2008
    Messages:
    1,787
    Location:
    Sydney
    At the moment there are going to be 4 devices, installed on a trial/pilot basis. If they were work as planned, similar devices will be rolled out over the entire site, which would be 50+.

    I've been watching Putty tutorials all night, and will be downloading that in the morning to play with at work. In the long term, I don't think a GUI would be necessary, so an automated terminal script over SSH may well be the best option.
     
  7. FalconGT

    FalconGT Member

    Joined:
    Jul 1, 2001
    Messages:
    1,538
    Location:
    Ballina
    Awesome, keep us updated of your progress and if you need some ssh help, just ask.
     
  8. OP
    OP
    jars121

    jars121 Member

    Joined:
    Mar 6, 2008
    Messages:
    1,787
    Location:
    Sydney
    You sir, are a gentleman and scholar. I will definitely keep this thread updated.

    I'm getting my ahead around the programming side of things at the moment. The more I learn about Python, the more I fall in love with it. Coming from a VB background, it all makes sense.

    Having a bit of trouble with the subprocess script/process, but I will persevere :)
     

Share This Page

Advertisement: