Internet to Serial Proxy

Internet to Serial Proxy for Mac OS XInternet to Serial Proxy

Internet to Serial Proxy is an open source application which facilitate the communication between a Web API and an Arduino connected to a Mac USB Serial Port.

INTERNET < > Internet to Serial Proxy < > USB ARDUINO

Download Internet to Serial Proxy
Version 03 – Compiled for OS X Lion tested with Mountain Lion and Mavericks
Still running Snow Leopard? Get the previous version.

 What it does

First, you DO NOT NEED an Arduino Internet Shield. The Internet to Serial Proxy open the chosen TCP/IP port and listen to it. When it get a connection, it transmit what it get to the connected serial port. The data send from the Arduino are also sent to a specified URL. It’s also monitor what’s the Arduino send through the serial port. It’s pretty basic. You can also send a manually entered string to the serial device.

Project sources

Github Social CodingVisit the Internet to Serial Proxy project home page on Github to get some PHP scripts and an Arduino program example, submit issues or get informed about current developments.

Screenshot

Internet to Serial Proxy version 03 Screenshot


28 thoughts on “Internet to Serial Proxy

  1. This is super helpful!

    I’m new to using PHP and flash – I was wondering if you could help me figure out what PHP script i need to have to facilitate a connection between a really basic flash app and your proxy program. I looked at all of your example scripts, but i don’t really understand how to facilitate the connection.

    Cheers!

  2. I’m no Flash guy, but I think you only need to understand how pass variables from PHP to flash and the opposite. The PHP example script I give is only about sending these variable through the Internet to Serial Proxy. Your flash application P needs to get these variables from the PHP script. I’m sorry, but I can’t help you more with Flash things.

  3. I’m sorry, but I can’t. Xcode 4 don’t come with the 10.5 SDK. The sources files are available. You can try building it yourself. I think it will work without any modifications.

  4. Hi Kevin, I´m a newbie to arduino and have limited client/server knowledge. I hope your proxy software can solve a problem I have in my project. So have I understood this correctly; I can have my mbookair connected to internet with WIFI and my Arduino connected to my mbookair with USB. Then request a page on the web in my browser that say, returns values, which in turn I can use to control my arduino pins? Correct?

  5. Almost. You can’t directly open your browser to ip:port of the Internet to Serial Proxy (ISP) app. It will do nothing. You have to push information to it. You can get the two php scripts and host them on your Macbook using MAMP or host them on an external standard Web server. If you opt for the second solution, you will need to have the ip:port of your Macbook accessible from outside of your home network.

    You then will have to write some code on the Arduino and the Web server. So as a sample you can send a character like “x” to the ISP app and the app will send it to the Arduino. Then you have to interpret this “x” character in the Arduino and do something with it, like light a LED. You can see a bit more in «Please follow the protocol» post.

  6. Is there any way of sending the data received from the arduino as part of the web address?

    I am trying to call a specific webpage for individual button pushes on the Arduino…

  7. This is not impossible. The problem is this direct call will not close itself. The browser will hang trying to get a response that never comes. If you still want to do it this way, you will have to interpret all the HTTP header in the Arduino. The first line contains the parameters you can send by calling Internet to Serial Proxy with a query parameter like http://localhost:port?a=your-stuff (the IP and port of Internet to Serial Proxy). You will get data shown below, the you could read and use the first line. The best way is to make your script call a php script (or else) then make this script open a socket and send stuff to ISP.

    GET /?a=TEST%20STRING%20SEND%20TROUGHT HTTP/1.1
    Host: localhost:8883
    Connection: keep-alive
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Accept-Charset: UTF-8,*;q=0.5
    Cookie: SQLiteManager_currentLangue=2

  8. Hello Kevin, this seems like a great app, but I’m not getting the program connected to net (not sure why)

    Basically, what I have is an RFID reader plugged into Arduino.. Through your program I’ve managed to set up the connection with the serial, and the values are being presented in the Activity Log.

    Then, what I want is to send these values to my .php page. I have set up a XAMPP localhost server and placed a file (example.php) there, but am not sure how to send the values, or how to get them in the file. I would be really greatfull if you could help out!

  9. let me reformulate: I opened up the socket successfully using the code you give in the “PHP Script Send Example” …

    Then, how do I recieve the output of the arduino in my PHP webpage? I basically want the same information that is getting outputed in the “Activity Log” of the program, in the PHP webpage.. is this possible?

  10. It’s not much of a connection. Just set the url to get in the App. If it’s on your local host, the url will look like http://localhost/example.php. In your PHP script, you have to read the q parameter from the query string. You can record this data into a database or a file, then use this cumulated data to do something. Or create a script to trigger an action.

  11. It’s two thing. One to send something to the Arduino. It’s what you seem to have working. And an other when the Arduino send something to the net. It’s no synchronous communication here.

  12. Kevin, nice work with the ISP. Was wondering if you had plans to implement POST as well as GET, so one can send larger chunks of data? I cant recall off the top of my head what the max number of characters you can submit via GET… but one can definitely send more with POST.
    Thanks,
    –Greg

  13. If I remember correctly, the serial UART have a 128 characters buffer length. So you can’t send longer strings to it.

  14. Hi! I’m really new to this. I really hope you can help me out.

    Basically, I need to send an RFID serial number to a PHP page. I’ve successfully connected the RFID USB Reader and the serial number is reflected in the Activity Log.

    My Net is not connected and I’m not sure why.
    My Preferences are as follows:
    Listen to port: 8888
    Request URL: http://localhost:8888/rfid.php
    (I am using MAMP)

    In my rfid.php, I’m using this code:

    However, I don’t seem to get the serial ID reflected on my rfid.php page.

    Could you please point out my mistake?

    I hope to hear from you soon, Thank you!

  15. oops, my code wasn’t reflected in the previous post

    $response = $_GET['q'];
    print ($response); //this is supposed to print out my RFID serial ID

    error_log(“Internet to Serial Proxy Response: {$response}”);

  16. Hi. In the Internet to Serial Proxy app, can you see what is sent from the Arduino in the console log? Normally what is seen there is sent to the php page. Do you see a “Succeeded!” message after the string that must be sent in the ISP app log window?

  17. Hi Kevin. In the Internet to Serial Proxy app, a serial number from my RFID reader is successfully reflected. But it is not reflected in my php page.

  18. Hi Hafilah, can you send a screen capture of the app config page and the php code so I can help you debug.

  19. Hi Kevin. Thank you for the fast response.

    Here are the screenshots:
    https://picasaweb.google.com/lh/photo/9jgMhtICYwoPUlfOmgPsSVgydSgKda6Jp-Njx_t7Drw?feat=directlink
    (Internet-to-serial-proxy setup and Arduino code (copied and paste from github))

    https://picasaweb.google.com/lh/photo/s0YfSAubiyO5a3vwde69gVgydSgKda6Jp-Njx_t7Drw?feat=directlink
    (rfid.php – PHP code)

    There’s no output when I run the rfid.php page. It displays a blank page. I’ve placed the rfid.php page in MAMP htcdocs folder.

    All I need is to display the value of ID (67007BC138E5) read from the RFID reader in rfid.php.

    I’m very new to Arduino and there’s a lot of things that I do not know and need to learn. Really appreciate your help, Kevin.

  20. The first thing I see is a port conflict. You can’t use the same port for MAMP and the ISP app. Can you try a different one in the “Listen to port” field of the ISP.

  21. What does “Listen to port” means? How and where can I obtain the port number?

  22. ISP is listening to a port to get data from a php script. It’s like a little Web server. To talk to ISP from a php script, you must call the app with the IP of the computer ISP running on, and the given “Listen to port”. Please see this example script : https://github.com/playwithmyled/Internet-to-Serial-Proxy/wiki/PHP-Script-Send-Example

    So if you use the same port for the IPS and MAMP, you have two apps on your computer trying to listen to the same port.

  23. If MAMP app is running on port 8888, then your url is ok in ISP. The line “print $response” is useless since ISP will not output the result of the Web page. The line “error_log(‘…’)” output the result in the PHP error log.

  24. Okie. I think I understood the setup.

    My output now in ISP is:

    Ready!
    Attempting to open port…
    Port opened.
    67007BC138E5
    Net connection established.

    GET /rfid2.php?q=%0267007BC138E5 HTTP/1.1
    Host: localhost:8888
    User-Agent: Internet%20to%20Serial%20Proxy/ CFNetwork/596.3.3 Darwin/12.3.0 (x86_64) (MacBookPro9%2C2)
    Accept: */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    Connection: keep-alive

    I assume the above output is correct? :)

    Is there a way for me to open the page /rfid2.php?q=%0267007BC138E5 automatically as I scan my RFID tag?
    Or is there any way to pass the value (q=%0267007BC138E5) to another php and open the page automatically as I scan my RFID tag?

  25. Looks fine to me. The script on the Web server, your rfid2.php, can’t force a browser to open a page. What you can do, is to record the received data into a db or a file. Then program a php/ajax page that continuously check for the data in the file and display it.

    So you manually open the php/ajax page in your browser. This page will check, maybe every 10 seconds, for a new thing to append.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>