Using the Web to control servo at home ideas
dingobats
Posts: 6
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
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
Comments
If you don't use the Spinerette, you'll need something else with Ethernet capability.
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.
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?
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.
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/
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.
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.
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
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?
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.
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)
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.
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.
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?
However, a counter or serial to parallel IC will handle 10 LEDs. There are also I2C pin extenders.
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?
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.
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?
HTTP (socket) request
Spinneret web server parses the request header
The Dispatcher determines if the request is static or dynamic and routes the logic accordingly
Static requests are files resources on the SD card.
Dynamic requests are usually custom code blocks that perform a task like lighting an LED.
Static and Dynamic requests always return a response.