{"id":19960132,"url":"https://github.com/born2net/mediaarduino","last_synced_at":"2025-05-03T21:31:25.337Z","repository":{"id":22949428,"uuid":"26298937","full_name":"born2net/mediaArduino","owner":"born2net","description":"Open source Arduino project for digitalsignage.com using \nnode.js and Firmata","archived":false,"fork":false,"pushed_at":"2017-04-17T07:40:40.000Z","size":40128,"stargazers_count":57,"open_issues_count":2,"forks_count":33,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-07T21:51:22.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Arduino","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/born2net.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-07T01:51:38.000Z","updated_at":"2024-02-25T08:01:20.000Z","dependencies_parsed_at":"2022-08-21T16:11:42.975Z","dependency_job_id":null,"html_url":"https://github.com/born2net/mediaArduino","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/born2net%2FmediaArduino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/born2net%2FmediaArduino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/born2net%2FmediaArduino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/born2net%2FmediaArduino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/born2net","download_url":"https://codeload.github.com/born2net/mediaArduino/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252259305,"owners_count":21719659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:53:54.695Z","updated_at":"2025-05-03T21:31:20.329Z","avatar_url":"https://github.com/born2net.png","language":"Arduino","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eArduino Yun with node.js \u0026 Digital Signage Internet Of Things\u003c/h1\u003e\n==========\n\n\nIntroduction\n---------------------------------------\n\n\u003ch6\u003eDeveloped by MediaSignage (http://www.digitalsignage.com)\u003c/h6\u003e\n\u003ch6\u003eDigital Signage for IoT: http://alturl.com/zqp3z\u003c/h6\u003e\n\n\nArduino Yun is an amazing prototyping platform that allows anyone to build a custom solution for Internet of things (IoT).\nThis means that you can control lights, turn on oven toasters, get real time weather info, remote control servos, automate anything, without needing a degree in electrical engineering.\n\nWhile it's true that you can buy off the shelf products to enable IoT, such as Vera, Ninja Blocks etc... Arduino is unique as it allows you to:\n\u003col\u003e\n    \u003cli\u003e Create a fully customized product with very little effort\u003c/li\u003e\n    \u003cli\u003e Keep the cost down\u003c/li\u003e\n    \u003cli\u003e Creates an opportunity to build solutions for your clients and charge them accordingly\u003c/li\u003e\n    \u003cli\u003e You can choose from thousands of inexpensive sensors, relays, switches, and more\u003c/li\u003e\n    \u003cli\u003e Arduino is very popular which means you can find a ton of help and docs\u003c/li\u003e\n    \u003cli\u003e Arduino is easily expandable with shields (add on boards)\u003c/li\u003e\n    \u003cli\u003e It's 100% hackable so there are no limits\u003c/li\u003e\n\u003c/ol\u003e\n\nThis document was created to help you get started with Arduino and Node.js as well as to take advantage of a pre-compiled binary Linux image that you can download and burn onto your own Micro SD card.\nAnyone who is interested in setting up Arduino Yun with Node.js will greatly benefit from this doc.\nAlso, at the end of the document we cover integration between Digital Signage with Arduino as well.\n\nTo help you get started as quickly as possible we built a custom binary image that you can burn onto a micro SD card and load it directly onto the Arduino Yun.\nThe image includes Node.js 10.32, the Firmata drivers of Node.js and Firmata drivers for the Micro controller to allow communication between the two using the Yun bridge.\nWe also include a serial watchdog as well lots of sample apps, pre compiled binaries such as socket.io and more.\n\nTo summarize:\n\u003cul\u003e\n\u003cli\u003esimple to follow, step by step instructions on Arduino Yun setup\u003c/li\u003e\n\u003cli\u003eeverything that's needed to run node.js with Arduino Yun\u003c/li\u003e\n\u003cli\u003eprovide a perfectly setup pre-compiled binary of Linux OpenWRT image allowing for a quick setup of a new Arduino Yun\u003c/li\u003e\n\u003cli\u003epre compiled Firmata driver for both Node.js and as Arduino Sketch\u003c/li\u003e\n\u003cli\u003eweb server to allow communication between Arduino Yun and Digital Signage Internet Of Things\u003c/li\u003e\n\u003cli\u003ebuilt in watchdog to restart upon serial communication failure\u003c/li\u003e\n\u003cli\u003eApp for remote control of Arduino Yun across the web using SignagePlayer LAN server gateway\u003c/li\u003e\n\u003cli\u003eApp for socket client to connect to remote socket.io node.js server\u003c/li\u003e\n\u003cli\u003elots of sample scripts and applications including cyclon.js driver\u003c/li\u003e\n\u003cli\u003evideo tutorials, resource links and more\u003c/li\u003e\n\u003c/ul\u003e\n\n\nWhy Arduino Yun and Node.js\n---------------------------------------\n\nArduino IDE can load and compile sketches, which are C based code base that compiles into machine language and runs in a loop on top of the Arduino Yun Micro Controller (MCU).\nWhile C is a powerful language, it can be a pain to develop in, and even more of burden to debug.\n\nSay hello to Node.js (http://nodejs.org) Node.js, a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.\nNode.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js can process Javascript code right on the Arduino Yun Linux OS.\nThat's right, Arduino Yun comes with a built in \"Linux on a chip\" version of OpenWRT (https://openwrt.org)\n\nWhat this means is that you can develop (and even debug) in Javascript on the Arduino Yun, and use a driver called Firmata to translate Javascript commands onto the Arduino Yun micro controller.\nEssentially the Firmata is a wrapper over a serial driver that pushes bytes onto the Micro controller unit (MCU) as well as listens to data coming from the MCU.\n\nAnd if you find that you do need to develop something specific in C; you'll be happy to know that we have enabled in the Firmata driver an option to send and receive Strings.\nSo you can add custom C functions on the Arduino MCU, and invoke them from Javascript, if you need to...\n\n------------------------------------------------------------------------\n\nArchitecture\n---------------------------------------\n\nBelow you can get a sense of how things are laid out.\nThe process of sending a serial byte from your own developed javascript Node.js code and all the way down onto the MCU.\n\n\u003cpre\u003e\n+---------------------------------+\n|         Arduino Yun             |\n|                                 |\n|     +++++++++++++++++++++++     |\n|     +   #LINUX OpenWRT#   +     |\n|     +                     +     |\n|     +   [Your js code]    +     |\n|     +        |            +     |\n|     +    [node.js]        +     |\n|     +        |            +     |\n|     +   [Firmata.js]      +     |\n|     +        |            +     |\n|     +   [serialport.js]   +     |\n|     +        |            +     |\n|     +++++++++++++++++++++++     |\n|              |                  |\n|     +++++++++++++++++++++++     |\n|     + #serial Yun Bridge# +     |\n|     +++++++++++++++++++++++     |\n|              |                  |\n|     +++++++++++++++++++++++     |\n|     + #Micro Controller#  +     |\n|     +        |            +     |\n|     +  [Firmata C code]   +     |\n|     +        |            +     |\n|     + [custom functions]  +     |\n|     +++++++++++++++++++++++     |\n+---------------------------------+\n\u003c/pre\u003e\n\n\n\nArduino setup\n---------------------------------------\n\nWhen you first get your new Arduino Yun it will come configured as a WIFI hot spot.\nThis means you can connect to it directly using a mobile phone or tablet as it will serve an IP over DHCP so you connect to its built in web server.\nFollow these instructions to initially setup your Arduino Yun: http://arduino.cc/en/Guide/ArduinoYun (per Windows and Mac).\n\nNext, you will need a Micro SD card. You should get a 8GB Micro SD card.\n\nWhy 8GB you ask? since the binary OpenWRT image we built was created from a 4GB micro SD, there is a chance that it may not be exactly the same number of sectors as your 4GB Micro SD, which will result in failure as the binary image may not fit.\nSo to play it safe, get the next level up micro SD (8GB) and you won't have any issues burning the image in (it's only like $2.00 more, crazy how cheap memory is these days).\nThe binary image already has all of the Linux configuration on it including drivers, applications and configs, so you will not have to setup anything on the Linux side.\n\nFirst we will begin by updating the firmware of the Arduino to version 1.5.2, so copy this updated firmware file: http://alturl.com/8ivfo onto the root micro SD card.\n\n\u003cpre\u003e\nopenwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin\n\u003c/pre\u003e\n\nConfirm the file is in the root of the Micro SD (not in sub-folder), insert onto the Micro SD slot of the Arduino Yun and reboot it.\n\nOpen a up a web browser and point it to the address of the Arduino Yun (remember it is still a hot spot serving you an IP address).\nYou can most likely can reach it via the IP address of: 192.168.240.1 or via http://arduino.local\n\nNext, select to upgrade the firmware and reboot (it's the [RESET] at the bottom of the web page), it wil take a few minutes for the update to complete.\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/ardsc2.png\"/\u003e\n\nNext, when the device has been updated with the latest firmware, configure it to join your wifi network (click the configure button on the web interface) and once again reboot it.\n\nNext, we will burn the Linux OS onto the Micro SD card.\n\nTo burn the binary image we will use a HDD Sector copy application for Windows. Download it from: http://alturl.com/k333x\n\nInstall the application in Windows\n\n\u003cpre\u003e\nHDDRawCopy1.10Setup.exe\n\u003c/pre\u003e\n\nNext you will need to connect the Micro SD to the PC, it should come up as a drive letter in Windows, like F:\\ or something of that sort.\n\nNext, launch HDDRawCopy, select source from file (double click) and select the downloaded file of: http://www.digitalsignage.com/arduino/PerfectArduino.imgc\n\nNow click 'next' to select the target device, which will be the drive letter of the Micro SD (be sure tp select the correct drive letter or you may lose data by formatting the wrong device).\n\nNext, pick the Micro SD and click start to begin the burning process of the Linux OS image onto the micro SD card, this will take a little while.\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/burnsd.png\"/\u003e\n\nOnce it's done you can remove the micro SD from your PC and plug it into the Arduino.\n\nNow that the Arduino is on your WIFI or Ethernet network, you will need to know it's IP address.\nThe best way to figure this out is to install the Arduino IDE, from: http://arduino.cc/en/Main/Software\n\nNext, connect the Arduino to your PC or Mac via USB cable.\n\nInside Arduino IDE, select the board type from: Tools \u003e Board \u003e Arduino Yun\n\nNext, select Tools \u003e Port to see it's new IP address that the Arduino received from your local network.\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/ardsc1.png\"/\u003e\n\nAs you can see my IP address is 192.168.1.94 (yours will be different).\n\nNext you need to ssh (login) onto the Linux side of the Arduino.\n\nIn Mac ssh is part of the OS, in Windows, you can download cygwin which comes with ssh (https://www.cygwin.com/)\n\nOnce you confirm your Windows or Mac has the ssh command, execute ssh@YOUR_IP_ADDRESS, as in:\n\u003cpre\u003e\nssh root@192.168.1.94\n\u003c/pre\u003e\n\nDefault password is: arduino\n\nSelect 'yes' when ssh prompts you to remember the host.\n\nNext, while logged into the Arduino Linux, execute the commands:\n\n\u003cpre\u003e\nmkdir  /tmp/overlay-disabled\nmkdir /tmp/overlay-disabled/etc/\ncp /.extroot.md5sum /tmp/overlay-disabled/etc/extroot.md5sum\n\u003c/pre\u003e\n\nthis will create a clean md5 hash so OpenWRT accepts the Micro SD as a valid device to mount.\nDon't reboot the Arduino just yet, as we need to install the Firmata driver onto the MCU of the Arduino so we can communicate with it from the node.js using the Firmata.js package.\n\nDownload from this git repository the file of:\n\n\u003cpre\u003e\nfirmata/firmata.ino\n\u003c/pre\u003e\n\nand put it in a directory on your Mac or PC of: firmata/firmata.ino\n\nyou will also need to download 3 more files from this repository:\n\n\u003cpre\u003e\nfirmataSketch library\\Boards.h\nfirmataSketch library\\Firmata.cpp\nfirmataSketch library\\Firmata.h\n\u003c/pre\u003e\n\nYou will need to override the 3 default files that ship with Arduino as this library firmata files also add support for String argument passing to allow us to run custom C functions from Node.js.\nIn Windows override the files at:\n\n\u003cpre\u003e\nC:\\Program Files (x86)\\Arduino\\libraries\\Firmata\\src\n\u003c/pre\u003e\n\nIn Mac, I am not sure where are they located, it should be within the installation directory of the Arduino IDE installed App.\n\nNext, we will burn in the firmata.ino C sketch into Arduino\n\nIn the Arduino IDE App select to open the sketch of:\n\u003cpre\u003e\nfirmata/firmata.ino\n\u003c/pre\u003e\n\nIn the Arduino IDE App select Tools \u003e Port \u003e and select the Com port or IP address of the Arduino\n\nNext, click update and upload to burn in the Firmata driver onto the MCU.\n\nOnce it's done, reboot the Arduino\n\n---------------------------------------\n\nIs it all working?\n---------------------------------------\n\n\nAt this point you should be able to ssh back onto the Arduino, execute:\n\n\u003cpre\u003e\ncd /root\nls -al\n\u003c/pre\u003e\n\nyou should see a bunch of files, if you do, you are in good shape.\nIf you don't you must have missed a step as OpenWRT did not mount the Micro SD as the main Linux drive.\nNow lets test that Node.js can communicate with the Micro controller. Type:\n\n\u003cpre\u003e\n/root/dev/testFirmata.js\n\u003c/pre\u003e\n\nYou should see the text below and the red LED on pin 13 should blink a few times.\nIf you did, GOOD JOB, the hard part is behind you.\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/ardsc5.gif\"/\u003e\n\nKeep in mind that this test script will stop /root/start.js and free up the serial port so we can run the test,\nso you will need to reboot Arduino one time to get the /root/start.js node daemon to start back up (we will cover start.js in just a sec).\n\nSo what's installed on the Linux OS?\n---------------------------------------\n\nNext we will review some of the cool things you got as part of the pre-installed Linux OpenWRT OS:\n\n- serial driver and node modules\n- startup script and watchdog\n- socket communication\n- Digital Signage web server\n- More goodies...\n\n\u003ch5\u003eSerial driver\u003c/h5\u003e\nIn /usr/lib/node_modules/serial you will find the node.js serial driver that is the basis for all serial communication.\nAlso, in /usr/lib/node_modules/ you will find other node modules including express web server, firmata, underscore and others.\n\n\u003ch5\u003estartup script and watchdog\u003c/h5\u003e\nunder /etc/init.d/arduinostart you will find the daemon that kicks in when the Arduino is started.\nIt will in turn run /root/start.js which builds a communication path to the serial bridge.\n\nThe serial bridge between Linux OS and the MCU will remain occupied by start.js, so be sure to kill it before testing other scripts.\n\nInside C Sketch that runs on top of the MCU we have a statement of:\n\n\u003cpre\u003e\ndelay(10000);\n  Serial1.begin(9600); // Set the baud.\n  while (!Serial1) {}\n\u003c/pre\u003e\n\nWhich will wait for U-boot to finish startup.  Consume all bytes until we are done.\nWhile this hack works 95% of the time, there is still a slight chance the Arduino serial bridge will fail.\nBut not to worry, if it does fail, our watchdog which runs from start.js through /root/initSerial.js and it monitors the serial bridge.\n\nIf a connection is not establish within the given time frame, the Arduino Linux and MCU are restarted and messages are logged onto start.log.\n\nTo view stats.js startup script using the tail command execute:\n\n\u003cpre\u003e\ntail -f /tmp/start.log\n\u003c/pre\u003e\n\nSo within 1-2 boots the Serial bridge will recover, so restart your Arduino with confidence knowing you will always have a connection between the Linux OS and MCU.\n\n\u003ch5\u003e/root/clientio.js socket sample script\u003c/h5\u003e\nThe Arduino includes a sample socket script which connects to a socket.io sever (http://socket.io).\nIf you ever want to connect to a remote socket.io node.js server and bypass your LAN firewall and not have to create router maps in your local ISP's router, this is will work great.\n\n\u003ch5\u003e/root/start.js Express Digital Signage web server\u003c/h5\u003e\n/root/start.js is the main script that runs on boot-up.\nThe includes Express server that will listen to commands on port 3840 from the SignagePlayer gateway (or any POST for that matter) and assist in remote reading and writing I/O pin data.\n\n\u003ch5\u003eSample web application to send remote commands\u003c/h5\u003e\nOne of the great things about using the SignagePlayer as a LAN server (gateway) is the ability to securely send remote commands to the Arduino over the web.\nThis is done without having to open any firewalls or map internal IP / port addresses in your local ISP router. It's like the socket.io client, only that we at MediaSignage provide a free Socket web server for you as well as a local socket client,\nwhich is the SignagePlayer LAN Server.\n\nBecause the SignagePlayer operate as a LAN server, and since it already connects with a socket to the remote mediaCLOUD, it can also pass through events destined to the Arduino.\nTo learn more about this functionally be sure to checkout the video tutorial at: http://www.digitalsignage.com/_html/signage_video.html?videoNumber=arduino\n\n\nAdding custom C code on MCU\n---------------------------------------\n\nIf you look at the C code in our Arduino Firmata sketch:\n\n\u003cpre\u003e\nfirmata/firmata.ino\n\u003c/pre\u003e\n\nyou will notice that we added a snippet of C code:\n\n\u003cpre\u003e\nFirmata.attach(STRING_DATA, stringCallback);\n\u003c/pre\u003e\n\nthis allows you to send any arbitrary string from the Node.js side, and have it call the function:\n\n\u003cpre\u003e\nvoid stringCallback(char *myString)\n{\n\n    if (myString == \"do_something\") {\n        // send a string back to node.js Firmata driver\n        Firmata.sendString(myString);\n     }\n}\n\u003c/pre\u003e\n\nand so you can add additional custom C code on the MCU while still having the convenience of using node.js for the logic part of your code.\n\nAlso if you wanted to send back a string (data) back to node.js from the MCU, simple use the function:\n\n\u003cpre\u003e\nFirmata.sendString(myString);\n\u003c/pre\u003e\n\nwhich in turn will be received on the node.js via the function:\n\n\u003cpre\u003e\n board.on('string',function(string){\n        console.log('firmata log: ' + string);\n    });\n\u003c/pre\u003e\n\nCheckout /root/dev/testFirmata.js for a sample script that send and receives data to and from the MCU.\n\nIn addition, we also developed a custom function on the Sketch called seanBlinkerCallback.\nThis function can be executed directly from Node.js as we included the definition for the custom function as the command in Firmata.h header file:\n\n\u003cpre\u003e\n#define SET_SEAN_BLINKER        0xF1 // set a pin to INPUT/OUTPUT/PWM/etc\n\u003c/pre\u003e\n\nas well as in Firmata.cpp file:\n\n\u003cpre\u003e\ncase SET_SEAN_BLINKER:\n     if(seanBlinkerCallback)\n       (*seanBlinkerCallback)(storedInputData[1], storedInputData[0]);\n     break;\n\u003c/pre\u003e\n\nand call it from /root/dev/testFirmata.js using\n\n\u003cpre\u003e\nboard.seanBlinker(125, 125);  // value 1-127\n\u003c/pre\u003e\n\n\nArduino \u0026 Digital Signage\n---------------------------------------\nOne of the great benefits of using Arduino, is its seamless integration with the free Digital Signage service from http://www.digitalsignage.com\nAll you need is to install the SignagePlayer, and configure it as a LAN Server.\n\nOnce you do, you will be able to send and receive events / triggers from Arduino, as you can see below.\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/ardsc6.gif\"/\u003e\n\nPretty cool ha?\n\nThe SignagePlayer will essentially becomes a socket gateway to sending and receiving events.\nThis has the benefit of allowing secure socket commands to be sent to the SignagePlayer across the web and onto the SignagePlayer.\nFrom the SignagePlayer, the events will propagate to the appropriate Arduino.\n\nTo learn more about setting the SignageStudio to send events to specific SignagePlayers / Arduino IP addresses review the video at:\nhttp://www.digitalsignage.com/_html/signage_video.html?videoNumber=arduino\n\nIf you inspect the code in /root/start.js you will notice that it comes with a built in Express web server.\nThe server is pre-configured to listen to events coming from the SignagePlayer and act upon these events.\n\nIt includes crossdomain.xml to allow certain Sandbox clients (such as Adobe Flash / AIR) secure access to the web server.\nOf course you can modify it to do whatever you want, but by default if you send the express web server a post, using curl or a web browser:\n\n\u003cpre\u003e\ncurl http://192.168.1.94:3840/mcu13:1\ncurl http://192.168.1.94:3840/mcu13:0\n\u003c/pre\u003e\n\nit will toggle the LED connected to pin 13 (1 == ON and 0 == OFF).\n\nThe code that manages the pin number and state is part of the example included in start.js:\n\n\u003cpre\u003e\napp.all(\"/mcu:pin\", function (req, res) {\n     if (!serialReady) {\n         res.send(\"NOTREADY\");\n         return;\n     }\n     var pin = (req.params.pin).split(':')[0];\n     var state = (req.params.pin).split(':')[1];\n\n     console.log('setting pin ' + pin + ' ' + state + ' ' + getTime());\n\n     if (state == 1) {\n         board.digitalWrite(pin, board.HIGH);\n     } else {\n         board.digitalWrite(pin, board.LOW);\n     }\n     res.send(\"OK\");\n\n });\n\u003c/pre\u003e\n\n\nSending commands over the web\n---------------------------------------\n\nAnother sample application included in the Linux OpenWRT binary image is a web application that allows anyone to develop a Javascript based UI to send events directly\nto the SignagePlayer gateway and to pass these event to the Arduino.\nYou will find the web app under /root/public/webcommands.html which is served by the Express web server:\n\n\u003cpre\u003e\nhttp://YOUR_ARDUINO_IP:3840/webcommands.html\n\u003c/pre\u003e\n\nIf you want to test this script online (to confirm firewall bypassing is working) visit: http://www.digitalsignage.com/arduino/webcommands.html\nEnter your SignageStudio login name, password and station id (station id is retrived from Studio Pro \u003e Stations \u003e selected station grid).\n\n\nDebugging node.js on Arduino Yun\n---------------------------------------\n\nOne of the great benefits in developing in Node.js / Javascript vs C, is the ability to debug in real time your node.js code.\nYou can use the built in debugger in node.js, but we highly recommend using WebStorm or IntelliJ for a much better work flow: (https://www.jetbrains.com/webstorm/)\n\nIn WebStorm config the node.js as such:\n\n\u003cimg src=\"http://www.digitalsignage.com/_images/ardsc8.png\"/\u003e\n\nnext, you to to create ssh tunnel (in Windows install cygwin for the open source ssh client)\n\n\u003cpre\u003e\nnodem --debug-brk --nolazy ./testFirmata.js\n\u003c/pre\u003e\n\nand forward the port 5858\n\n\u003cpre\u003e\nssh -L 5858:127.0.0.1:5858 root@192.168.1.76 -N\n\u003c/pre\u003e\n\nnotice that we are using nodem (m = more memory) instead of the standard node executable (part of the our Linux image).\nThis is because you will need to give nodejs more memory to do real time debugging, so we just created an alias env script for node which gives it that extra working room:\n\nThe normal node runs as:\n\u003cpre\u003e\nNODE_PATH=/usr/lib/node_modules /usr/bin/nodejs --stack_size=1024 --max_old_space_size=20 --max_new_space_size=2048 --max_executable_size=5 --gc_global --gc_interval=100 $@\n\u003c/pre\u003e\n\nwhile nodem with extra memory runs as:\n\n\u003cpre\u003e\nNODE_PATH=/usr/lib/node_modules /usr/bin/nodejs --stack_size=1024 --max_old_space_size=20 --max_executable_size=50 --gc_global --gc_interval=100 $@\n\u003c/pre\u003e\n\n\nWhat's next\n---------------------------------------\n\nIn the source code you will find additional useful code and libraries which include:\n\n- cylonExample: Robotics Javascript cylon library from: http://cylonjs.com\n- echo.js: a simple way to interact between the MCU and Linux using stdin and stdout pipes\n- fireAlarm.js: Javascript example using multiple INPUT / OUTPUT pins and sending curl post\n- humanSensor.js: example using a human detector sensor\n- restart.sh: bash to restart Arduino gracefully\n- socketIOclient.js: a client library for interacting with socket.io node.js server, includes binary ws\n- testFirmata.js: general test script for Firmata and simple node.js web server\n- wifiResetAndReboot: reset shell script\n- diskSpaceExpander: Arduino storage expander (no need if you are using our image)\n- sysUpgradeImage: upgrade Arduino to release 1.5.2 (check Arduino.cc for newer builds)\n- initSerial.js: boot up test for MCU to Linux bridge connection\n\n\nResources:\n------------------------------------------------------------------------\n- node.js: http://nodejs.org\n- cylon: http://cylonjs.com\n- firmata.js: https://github.com/jgautier/firmata\n- arduino: http://arduino.cc\n- digitalsignage.com: http://www.digitalsignage.com (free digital signage)\n- start kits: http://sunfounder.com\n\nLicense:\n------------------------------------------------------------------------\n- MIT License\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborn2net%2Fmediaarduino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborn2net%2Fmediaarduino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborn2net%2Fmediaarduino/lists"}