Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Like Tree3Likes

Thread: Home Automation / Speaker Matrix / Control Webpage

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562

    Question Home Automation / Speaker Matrix / Control Webpage

    Hello everyone- long time geek, tinkerer, thingy maker, Arduino fanatic here. I have created a very basic web page which is hosted on my OpenWRT TP-Link router. This webpage runs simple CGI scripts to output serial commands through the USB port to my Arduino UNO, which in turn controls multiple relays to switch on/off a stereo amplifier, and switch on various sets of speakers around my house. I was able to make a CGI script for each set of speakers, and this script also turns on the amp when the speakers are selected.

    To make a long story short, I just purchased an audio matrix (8 inputs, 4 outputs) which can be controlled via serial (RS232). I can write a webpage and script to switch each of these inputs/outputs individually, but I would like to make a webpage that works as follows:

    A user selects "Tuner" from one button, and "Backyard" from another button, then clicks "Submit" which in turn runs the script, controlling the speaker matrix. The CGI script is pretty basic, and one script will be able to select the desired input / output combination on the matrix. The website to drive this is where I am lost.

    I have no idea where to start, what language to use, etc. I think I can install PHP, Perl, etc on the TP-Link Router. I am open for any and all suggestions, ideas, etc., for the design of the page and scripting.

    Thanks for the help!

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Wow, that's a mouthful.

    I'm going to be totally honest with you, dude...and I say this with all kinds of respect just for taking this as far as you have. I don't know where or how you got the help (or even if you did) to build out what you have built out, but you've probably stretched your support as far as you can, and in all likelihood you're going to be on your own. I would say Webzarus and I are the two people most likely to come up with any ideas for scripts that will do what you want, and I'm out because (among a few other reasons) I've never even heard of Arduino before, so it's pretty much him or no one on here, I would say.

    I'm not sure any web design forum will be able to help you, either, since what you're asking for extends beyond pure web design and even to some extent beyond web programming and more into electronics programming. This sounds more like something one of the old newsgroups would be able to help you out with (do newsgroups still exist? I legitimately don't know).
    sparkynerd likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Wow. Just WOW. I think you're gonna have to call Sheldon and the boys.

    All joking aside, Game is probably right - he and Webz are the two most likely to help. All I can think of is to use a set of simple dropdown menus in a form, send the results to a PHP file which will run whatever function the combination of choices triggers.
    sparkynerd likes this.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  5. #4
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562
    Thanks to everyone for the quick response! Not to disrespect anyone here... but I'm not sure if im making this sound more complicated than it is, or if it really is a difficult thing to do. I can handle the CGI scripting to output to serial, and everything downstream, but the webpage is where I'm lost. My webpage right now has a CGI script assigned to each button (Speakers "On", Speakers "Off", and it works great. Essentially, I would like to have multiple button presses on a web page to create or modify the CGI script before it is executed. Maybe there is a better way than a CGI script? Alpha- you mentioned PHP?

    Thanks again!

  6. #5
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562
    Would it help if I post the HTML and CGI script? (It is pretty basic, since I am a rookie at websites!)

  7. #6
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562
    How do they make a shopping website that you can select multiple items to add to a shopping cart, and then click "update cart?" I'm thinking this is somewhat similar... clicking 2 different buttons, and then the website acting on the input. Am I way off base?

  8. #7
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Quote Originally Posted by sparkynerd View Post
    How do they make a shopping website that you can select multiple items to add to a shopping cart, and then click "update cart?" I'm thinking this is somewhat similar... clicking 2 different buttons, and then the website acting on the input. Am I way off base?
    I do that using PHP - Game uses .ASP or .NET I think.
    I can shoot you some PHP for that if you like?
    sparkynerd likes this.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  9. #8
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562
    Alpha-

    That would be awesome and I would be forever grateful! PHP would be great, because I am fairly sure I can install that on my OpenWRT router. I have to ask a question since I am green as a pool table and twice as square: what do I do with the PHP code you provide? Will this have the buttons and have a way to output the code?

    Here are my notes from my notebook I keep):

    Use this syntax: xxnn\r
    xx is ON, OF, RS, AC (Turn on, Turn off, Status, Enable/Disable Acknowledge)
    nn is ranged from 1-16 (channel 1 to channel 16)
    \r is carriage return

    This is an my typical .cgi*file -
    *
    #!/bin/sh -ax

    #Send out the serial command

    # Turns on Relay 1
    *echo -e "ON1/r" > /dev/ttyACM0****
    # Turns off Relay 7
    *echo -e "OF7/r" > /dev/ttyACM0

    #Redirect the browser back to the index page

    *echo "Content-type: text/html"
    *echo ""
    *echo "<html><head><title>Arduino Audio Control</title>"
    *echo "</head><body>"
    *echo "setTimeout('Redirect()',0);"
    *echo " function Redirect(){* location.href = '../index.html';}"
    *echo " --></script></body></html>"

  10. #9
    Junior Member
    Join Date
    Jun 2013
    Posts
    7
    Member #
    36562
    Update-

    I am now going to use a matrix controller instead of the Arduino, but I still need to output a string though the serial port. This is the button layout on the front of the unit. I would like to make a webpage to mimic the functions. (Basically, you press one of the 8 input buttons on the left, and then one of the output buttons on the right, and the controller will make the switch.)

    autopatch_half-y-front.jpg

    I found software evaluation version to make a simple PHP page with the basic concept I need. I have the code H-E-R-E https://www.dropbox.com/sh/yx6ovrwqyd90216/Kiawy0wbNF

    There is a PDF in the folder that describes the serial command I need to send. To test the controller function, I connected my laptop to the serial port of the matrix controller, and used PuTTY to send a string of data from the serial port to the controller. Example: If I type CL2I1O4 T, the controller will patch audio input 1 to output 4. The controller switches immediately after the "T" is entered. On the PHP page I have, the check boxes work, but I need to send a command to the serial port based on which checkboxes are checked on the webpage (if input 1 and output 4 are checked, I need to send B]CL2I1O4 T[/B] to the serial port. Is this possible? I have been doing a lot of research on this, and I found one person was using "ONCLICK" to send a string to the serial port. Just an idea from an uninformed person...

  11. #10
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    onclick is a Javascript event handler, so PHP isn't "really" involved there. It's one way to do it, I suppose, but you'd likely need a PHP XML page to process whatever AJAX stuff you want to send to it.

    I don't know enough about PHP to even begin to understand what that script says or does, so I'm going to tap out here.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:00 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com