element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STEM Academy
  • Learn
  • Learning Center
  • STEM Academy
  • More
  • Cancel
STEM Academy
Forum Help Needed with Python and Web Client for Education
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STEM Academy to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 5 replies
  • Answers 1 answer
  • Subscribers 51 subscribers
  • Views 1384 views
  • Users 0 members are here
  • raspberry
  • client
  • python
  • web
  • stem space
Related

Help Needed with Python and Web Client for Education

mikedavis
mikedavis over 11 years ago

So I have been tinkering with Raspberry Pis for a little while now, and I am thoroughly convinced of their utility, and I am hoping to spread that out in my classroom.

 

On example of a project I would like to do is taking temperatures using the waterproof temperature probe.  There are many others, but that is a good place to start.  My students make it a habit to bring their devices (phones, computers, tablets) to class, and it seems like I should be able to get their devices to control a probe on the RPi.  The most obvious way to do that is through a web client.

 

So, I have some code I have been using for getting temperatures to report out to a Google spreadsheet by using gspread.  You can find it here: https://github.com/MDScience/temperature

 

I would like to use it improve upon it with a web client so that my students could use their device to go to the RPi and tell the probe to start collecting temperature information once they are ready.  I imagine there would be buttons and fields for required information (like the name of the file they would like to output to, and so on).

 

This, of course, is just the beginning.  We would want to do more than temperature measurements, and we would need other sensors and other web clients.

 

If there is a good tutorial, or a model to follow I would greatly appreciate knowing about it.  Similarly, if there are any engineers who have experience in this area, and would like to lend a hand, I would appreciate that as well.

 

Thanks!

  • Sign in to reply
  • Cancel
Parents
  • shabaz
    0 shabaz over 11 years ago

    Hi Mike,

     

    As I understand, you'd like students to use a browser to directly access their RPI (i.e. without using a cloud service)?

    In that case, web server function needs to be implemented on the RPI. There are many ways to do it, here are some:

     

    1. A popular method is to install apache which is an open source web server.


    2. The above is quite heavyweight, so some people prefer using a different web server called lighttpd which is more suitable for the limited resources available

     

    (There are tutorials on how to install/configure apache and lighttpd. You'd also need to know a minimum of html and possibly javascript to get clicking buttons and things working in the

    browser).

     

    3. It should be possible to implement a web server in Python alone (i.e. not install apache/lighttpd). It's not something I know about (I don't use Python) but I did

    see this SimpleHTTPServer information so it is certainly possible. You still need some html (and Javascript probably) for this and all other methods.

     

    4. Yet another method is to use Node.js and write your server application in JavaScript. It could call the Python program as needed, if you want to minimise code re-write.

     

    I prefer approach (4), it is a great approach for a small web application. If you are familiar with Python then (3) could be considered.

     

    By the way, if you're willing to wait a couple of days, then an approach (4) method will be published that could help start you off with some functionality.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • mikedavis
    0 mikedavis over 11 years ago in reply to shabaz

    Thanks, that is helpful.  I have been able to install apache and make the RPi a local web server.

     

    I agree, that I should be able to something completely in Python.  I, however, am not that great in it, and I am a little leary about wading in too deep on that kind of thing. 

     

    Sounds like (4) is a good way to go.  If it could provide a web-interface that would call the program when needed, then I think that would be the best thing.  I have a couple days to wait.  Where could I find the method when it is published?

     

    Thank you!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 11 years ago in reply to mikedavis

    Hi Mike!

     

    I've kicked it off here, with some experiment suggestions, although I'm no expert in STEM - so I'm hoping you and others can adapt and improve it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 11 years ago in reply to mikedavis

    Mike,

     

    Steps for a web server:

     

    1. Open terminal session
    2. May need root access depending on what files you serve (warning dangerous with students crashing system!)
    3. Type: Ifconfig noting what IP address you have while connected to a router. You will need in step 6.
    4. Add a simple html page called index.html with nano
    5. Type: python3 -m http.server 8000
    6. On another computer type: http://102.168.1.99:8000/ changing IP address from step 3.
    7. If all went well, you should now see that web page displayed from the RaspPi. imageimage

     

    Cheers,

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • clem57
    0 clem57 over 11 years ago in reply to mikedavis

    Mike,

     

    Steps for a web server:

     

    1. Open terminal session
    2. May need root access depending on what files you serve (warning dangerous with students crashing system!)
    3. Type: Ifconfig noting what IP address you have while connected to a router. You will need in step 6.
    4. Add a simple html page called index.html with nano
    5. Type: python3 -m http.server 8000
    6. On another computer type: http://102.168.1.99:8000/ changing IP address from step 3.
    7. If all went well, you should now see that web page displayed from the RaspPi. imageimage

     

    Cheers,

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube