npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

johnny-five-android-termux

v1.0.6

Published

Johnny-Five TCP client for Android devices running Termux.

Downloads

10

Readme

Johnny-Five-Android-Termux

Johnny-Five TCP script for Android devices running Termux. Works with USB-OTG connected boards.

Based on the code snippets from Luis Montes.

Introduction

Johnny-Five is an outstanding library that allows the remote control of Arduino or other IoT boards using Node.js scripts running in virtually in any system.

Android mobile phones have all the perks you would want for your Arduino board (screen, real time clock, storage, LTE/GSM, sensors, WiFi, Bluetooth, Cameras, UPS, charging circuits, microphones, etc...). Combining the processing power of an old phone with the IO ports offered by the Arduino circuits is the ultimate ecological and cheap way to have the perfect IoT device.

This script allows Johnny-Five to run from a Termux terminal communicating with other Android apps or external devices by using the TCP protocol without root. The reason for the TCP protocol is that Termux still does not implement USB-OTG to Serial drivers, and the vanilla Johnny-Five would hang right out the box.

If you want to connect the board in the same device using the USB-OTG port you will just need a TCP bridge application. I added bellow some free and paid options.

Image

Release notes

  • Version 1.0.6 - Tested on Android with Termux 0.117 (F-Droid) and Node 14.15.4 (August 2021)

Requirements

Android apps

PC apps

Termux packages

  • nodejs (or nodejs-lts if not working)
  • python
  • clang
  • make
  • openssh (optional to operate the device from a PC)

Installation

  1. Install the Firmata sketch in your Arduino/IoT board. Detailed instructions can be found in the Johnny-Five platform pages.
  2. Install the Termux packages using the command pkg install followed by the name of each one of the packages:
pkg install nodejs
pkg install python
pkg install clang
pkg install make
pkg install openssh
  1. Run npm install johnny-five-android-termux from a blank directory where you want the script to be installed
  2. Edit the index.js file and configure for your TCP-Serial Server host and port. Note that inside this file you have a section to include your Johnny-Five code. The default script is the famous blinking led.
  3. Test the script running node index.js from the same directory. If the TCP bridge is working, the script will be able to connect. If the Arduino board (with the Firmata firmware) is connected via USB to the phone and the USB-TCP bridge software is working, the led will start to blink.

Node-Red integration

Node-Red, the ultimate IoT interface can be run from Termux and the following tutorial in my web page explains how to make use of Johnny-Five library in this framework.

FAQ

  • What is the default baud rate for Firmata? The default value is 57600bps.

  • I only get the message "Connected to server" and nothing else Please check the baud rate of the server. It should be set for 57600bps.

  • Do I need to root my Android device in order to access the Arduino board using USB? No. Just use a USB-Serial to TCP bridge app and you are fine.

  • I can't connect to a TCP server broadcasting in my own WiFi network Please make sure that your Android is not running a VPN or a Firewall.

  • Running out of disk space in the Android device After the installation you can remove the python, clang and make packages.

Troubleshooting

  1. Install Node.js in your Laptop/Desktop and run exactly the same installation procedures above. Depending on your OS you will need additional compiling tools to setup the serial interface module.
  2. Run the TCP server (like the COMbyTCP) in the same computer and try to connect between the board and the local installation of this script. If it does not work, you might have a problem with the Firmata installation in the Arduino board.
  3. If the connection works, keep the TCP server running in the computer and try to connect from the mobile device. If does not work you have a connectivity problem in the Android device.