+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: Using the Web to control servo at home ideas

  1. #1

    Default Using the Web to control servo at home ideas

    Hello everyone,
    I want to be able to control say 4 servos at home. I would visit a webpage (that I can code myself) that will have 4 buttons to control each servos.
    How can I achieve this? I looked into Spinneret, but I am relatively new to these kinds of things so I would like to see what are better for my case.
    I've also looked in to the mini-usb p8x32a, but that would required the use of a computer. I would like to not use a computer if possible.

    I guess I just want to be able to have some Servos interact with a webpage depending on what gets clicked.
    Is this possible?

    Thanks in advance

  2. #2

    Default Re: Using the Web to control servo at home ideas

    If you don't want to use a computer, then a Spinerette is is one option. I'm not sure what you mean by "mini-usb p8x32a"? Is this the QuickStart board? The QS by itself wont be able to do this. The Spinerette could.

    If you don't use the Spinerette, you'll need something else with Ethernet capability.

  3. #3

    Default Re: Using the Web to control servo at home ideas

    Hi Duane,
    yes that is the quickstart board.

    How difficult is it to achieve this with the Spinerete? I can't find much information or demonstrations online for using this in the way that I am thinking of.

  4. #4

    Default Re: Using the Web to control servo at home ideas

    Quote Originally Posted by dingobats View Post
    Hi Duane,
    yes that is the quickstart board.

    How difficult is it to achieve this with the Spinerete? I can't find much information or demonstrations online for using this in the way that I am thinking of.
    The hard part will be setting up the Spinerette to use from the Internet. When I tried to get my Spinerette up and running, I was never able to get "port forwarding" to work. I had a really bad internet connection at the time and it turned out my modem was going bad so I might be able to get it to work now.

    Once you can interact with the Spinerette over the internet, the rest should be very hard. Driving a servo with a Propeller is pretty easy. I have a video of a QuickStart board driving 32 servos here. There's a relatively simple servo demo with the demo folder of the Propeller Tool's library. I made an even simplier demo and posted it to my QuickStart servo tester thread.

    You'll want to look around in the Spinerette forum to see how to set up port forwarding and to learn the other stuff about using the Spinerette from the internet.

  5. #5

    Default Re: Using the Web to control servo at home ideas

    Hi Duane,
    So have you been working with Spinerette? I searched around and found SitePlayer. http://netmedia.com/siteplayer/webserver/spk1.html .have you heard about this?

  6. #6

    Default Re: Using the Web to control servo at home ideas

    I haven't heard about SitePlayer before.

    There's a lot of good information about the Spinerette in the Spinerette forum. Make sure and check the "stickies" at the top of the forum listings.

  7. #7

    Default Re: Using the Web to control servo at home ideas

    I use siteplayer modules. The pro's are that it's easy to do the html , it's relatively cheap, and you can upload new html to it to change the web page remotely. The con's are that there's no support, and you'll need a post-processor to do all the servo handling. There's a yahoo group that you can join, though it's not very active.

  8. #8

    Default Re: Using the Web to control servo at home ideas

    I almost forgot...one of my siteplayer projects is public, and it was an entrant in an old parallax SX contests

    http://www.parallax.com/tabid/683/Default.aspx

    I now live on Kauai and haven't made a visit back to the camera in years......it's like the mars rover, just sitting there all by it's lonesome unloved, probably ready to fall off the cliff. The pan feature no longer works...probably a broken wire.

    you'll have to accept an activex to view the video, but the URL is http://75.111.49.196:3398/

  9. #9

    Default Re: Using the Web to control servo at home ideas

    dingobats,

    The Spinneret is up to the task. Here's a simple IO example.
    http://www.agaverobotics.com/spinneret/controlpanel.htm

    Basics for interacting with the Spinneret (web page).
    http://spinneret.servebeer.com:5000/

    You can do the same with the Quick Start board, the only difference is a PC would host the web site or route traffic to the Quick Start via the serial port.

  10. #10

    Default Re: Using the Web to control servo at home ideas

    Mike that is so cool! You may have convinced me into getting a Spinneret now.
    Fix it, if it ain't broke! .......... D Rat .......... Dave ..........

  11. #11

    Default Re: Using the Web to control servo at home ideas

    Quote Originally Posted by Duane Degn View Post
    The hard part will be setting up the Spinerette to use from the Internet. When I tried to get my Spinerette up and running, I was never able to get "port forwarding" to work. I had a really bad internet connection at the time and it turned out my modem was going bad so I might be able to get it to work now.
    .
    When you can't do port forwarding for whatever reason, then if you can get away with a little bit of latency, set up a MYSQL DB on some webserver, add some fields for commands, have the Spinerette read the DB(can be done easily via a webpage coded with PHP that is parked on another webserver). The Spinerette reads the DB at some rate. Create another web page that lives on a webserver, use PHP very easily on it to add some buttons or text input fields, which will update the database with data or commands. The database is acting as an intermediary for the Spinerette and some web page to transfer data. Likewise, the Spinerette can update the database with a response, so the command input webpage can get status from the Spinerette indirectly as well. I have examples of this if needed.

  12. #12

    Default Re: Using the Web to control servo at home ideas

    T Chap, good point. I've done something similar for controlling robotic arm sequencing.

    Fair warning, you have to be prepared for the amount of traffic involved in polling then web server. You don't want a big bill from your hosting service.

    @ratronic, thanks... Plus you can run a Dynamixel network rather easily over the web

  13. #13

    Default Re: Using the Web to control servo at home ideas

    Quote Originally Posted by T Chap View Post
    When you can't do port forwarding for whatever reason, then if you can get away with a little bit of latency, set up a MYSQL DB on some webserver, add some fields for commands, have the Spinerette read the DB(can be done easily via a webpage coded with PHP that is parked on another webserver). The Spinerette reads the DB at some rate. Create another web page that lives on a webserver, use PHP very easily on it to add some buttons or text input fields, which will update the database with data or commands. The database is acting as an intermediary for the Spinerette and some web page to transfer data. Likewise, the Spinerette can update the database with a response, so the command input webpage can get status from the Spinerette indirectly as well. I have examples of this if needed.
    T Chap,

    Thank you for the information. I haven't tried to set up port forwarding since I purchased a new DSL modem.

    If I need to use a websever, so have any suggestions on who to use? Are there any free alternatives?

  14. #14

    Default Re: Using the Web to control servo at home ideas

    I always go with a deluxe hosting account with Godaddy. With this account, you can add as many domains to it as you want for around 10.00 each. It is a minimal effort to create a mysqyl database and add fields. So you need several ingredients to do what I suggest. First, I do not bother trying to write code on the Prop for http protocol, that gets to be a headache for me, especially for things like accessing a database. Instead, PHP is very easy to figure out, and create little pages that do all the real http work and just echo the responses. I will give you an example of a PHP page that you can pass the database address, username, and password. The mysql database can be on the same server or on any other server. Finding a free webserver may be possible to park the pages, but parking a database for free.. I am not sure if that exists, you can google free mysql database, free hosting etc. Who cares if they banners etc, no one is ever going to see the page but you probably. Most of the sites I have used are cheap, domains can be around 10 a year, hosting for a single site can be around 10 also. Finding a service with a quick install mysql db will make things easier. It doesn't get much easier than Godaddy IMO.

    This is a page that will read a database and echo what you need back. This could be one or many values returned.

    You would need to modify this to your needs. PHP is quite easy compared to Spin, so it would be no problem to modify the code here. Server is the address to find the db. DBU is the username and DBP is the password.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <title>Read DB</title>
    </head>
    <body>
    <br>
    <?php $con = mysql_connect($_REQUEST[SERVER],$_REQUEST[DBU],$_REQUEST[DBP]);
    if (!$con)
    // See if the connection to the DB was made
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    if ($con)
    {
    echo "CONNECTED TO DB";
    } 
    mysql_select_db($_REQUEST[DBU], $con);
    $result = mysql_query("SELECT * FROM $_REQUEST[TABLE]");
    while($row = mysql_fetch_array($result))
    {  
    echo "DVR=";
    echo $row['DVR']
    WHERE ID='$_REQUEST[ID]';
    echo "DVON=";
    echo $row['DVON']
    WHERE ID='$_REQUEST[ID]';
    echo "DVOFF=";
    echo $row['DVOFF']
    WHERE ID='$_REQUEST[ID]';
    echo "BASEIP=";
    echo $row['BASEIP']
    WHERE ID='$_REQUEST[ID]';
    echo "SDOWN=";
    echo $row['SDOWN']
    WHERE ID='$_REQUEST[ID]';
    echo "CLEAR=";
    echo $row['CLEAR']
    WHERE ID='$_REQUEST[ID]';
    echo "RSTTIMER=";
    echo $row['RSTTIMER']
    WHERE ID='$_REQUEST[ID]';
    echo "DAY=";
    echo $row['DAY']
    WHERE ID='$_REQUEST[ID]';
    echo "HOUR=";
    echo $row['HOUR']
    WHERE ID='$_REQUEST[ID]';
    echo "MINUTE=";
    echo $row['MINUTE']
    WHERE ID='$_REQUEST[ID]';
    echo "CLOSED"   .  mysql_error();
    }
    mysql_close($con);
    ?>
    <br>
    <br>
    </body>
    </html>
    This is the code I used on the Prop to access the ReadDB page. It is not coded for the Spinerette, but rather for a wifi device via UART with the 4 port object( port 1 is for serial terminal debug, port 2 is the wifi device commands)
    Code:
    PUB ReadDB
        ser.str(1, string("READ DB"))
        ser.tx(1, CR)
        beep(19, 2500, 100)
        w(20_000_000)   '   wait
        beep(19, 2500, 100)
        w(20_000_000)    
        beep(19, 2500, 100)
        ex   'exit if it was open from previous
        ex
        ser.str(1, string("---"))     'debug
        ser.str(2, string("$$$"))  ' enter command mode on wifi
        Viewreply    
        ser.str(2, string("open xxxxxxxxxx.com 80"))     '  your webserver domain name where the page is loaded
        ser.tx(2, CR) 
        Viewreply
        Viewreply
    
        ser.str(2, string("GET /readdb.php?"))     ' open the web page shown above
        ser.str(2, string("TABLE=table1"))   'DB table name    '  provide the table name in the db
        ser.str(2, string("&ID=1"))    'system ID      in case of multiple systems using same db
        ser.str(2, string("&SERVER=xxxxxx.db.xxxxxxxxxx.xxxxxxxxxresource.com"))    '' DB server
        ser.str(2, string("&DBU=xxxxxxxx"))      ''DB username
        ser.str(2, string("&DBP=xxxxxxxxx"))     'DB password
        ser.str(2, string(" HTTP/1.1"))   'http GET terminator
        ser.tx(2, CR)
        ser.tx(2, LF)
        ser.str(2, string("Host: xxxxxxxxx.com"))  
        ser.tx(2, LF)   ' two LF required
        ser.tx(2, LF)  
    
        RecWifiData    'after sending the command to open the page, now read whatever comes back
        ParseDBReply   'disect and act on commands

    The last ingredient is the page that is used to update the DB remotely by the user. This would mean changing a value on the database, this could be as simple as making a value become a 1 if you want to turn on an LED, or make the value 0 to turn it off. However, If the command is not desired to repeat over and over, you should add a field that I call a Confirmation Flag that the Spinerette can then toggle OFF after it successfully executes the command. For example.


    1. A page with some buttons on it can be loaded by a user, pressing a button sends an update to the database and modifies a field with a command value. It also sets the CONFIRM flag to 1 so that the Spinerette will know there is data available for use. Sort of a flow control.
    2. Spinerette reads DB and checks to see if the Confirm Flag has been to 1 = DATA READY( this could be as simple as the remote page setting the flag to a 1 if there was new data or commands added to the DB.
    3. If the Flag is a 1, meaning new data or commands posted, the Spinerret will then parse the commands and do what it should do based on the command
    4. After doing the command, the Spinerette accesses a page I call CONFIRM.php. This page will then reset the Confirm flag to a 0 so that A. The remote user can know if the command has been executed, and B. The Spinerette does not keep repeating the same command over and over again.
    5. A Status page can be set up that reads the CONFIRM flag and shows the status of the command. Continuous refreshing will eventually show the flag set back to 0, meaning the command was executed.

  15. #15

    Default Re: Using the Web to control servo at home ideas

    T Chap,

    Thanks for all the information. This is definitely something I what to do some day.

    I'll probably use Godaddy when I need a online database server.

    Thanks again.



    @Mojorizing, Very cool camera setup.

  16. #16

    Default Re: Using the Web to control servo at home ideas

    Thanks Mike,
    That webpage about lighting up the led was awsome. I think it may be just want I wanted.
    Do you be any chance know how many IO's are on the board? What if I wanted to light up 10 led how would I go about this?

  17. #17

    Default Re: Using the Web to control servo at home ideas

    There's 6 free IO. Please see the Spinneret page for product details.

    However, a counter or serial to parallel IC will handle 10 LEDs. There are also I2C pin extenders.

  18. #18

    Default Re: Using the Web to control servo at home ideas

    Hey Mike,
    I just realized that you were the 1st place winner of the contest. Late congratulations!

    Would your led tutorial allow me to utilize all 6 of the IO?

  19. #19

    Default Re: Using the Web to control servo at home ideas

    Would your led tutorial allow me to utilize all 6 of the IO?
    The tutorial has IO examples but is more geared toward the HTTP protocol. The tutorial talks about passing data to the Spinneret, executing custom logic,and parsing response XML. The Propeller manual better explains how to utilize Propeller IO.

  20. #20

    Default Re: Using the Web to control servo at home ideas

    Hi Mike,
    I hope you don't mind me asking you some very basic questions on Spinerete that you've probably answered many times.
    What I got from your tutorial is this:

    1. Spinerete sets up a web server.
    2. HTML sends a query to the dispatcher
    3. The dispatcher decides which IO to turn on/off

    Is this correct?

+ Reply to Thread

Similar Threads

  1. Looking For Ideas - Temperature Control
    By idbruce in forum Propeller 1 Multicore Microcontroller
    Replies: 50
    Last Post: 04-12-2012, 10:36 PM
  2. [chatter] I-Crib Total Home Control and Automation
    By graffix in forum General Discussion
    Replies: 81
    Last Post: 11-19-2011, 11:25 PM
  3. Home control test
    By Tumbler in forum General Discussion
    Replies: 10
    Last Post: 11-22-2010, 02:07 PM
  4. Replies: 1
    Last Post: 03-20-2004, 04:22 AM
  5. Protection for servo motors using Home Work Board-Breadboard
    By Archiver in forum BASIC Stamps Archive
    Replies: 4
    Last Post: 03-20-2004, 03:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts