Run python code on a smartphone to see LED turn on.
- Wirelessly run python programs that control Arduino
- Control android without rooting
- Access sensors available in smartphone i.e. camera, GPS
Follow Setup
instructions then run the following on python ssh terminal to control LED.
tn.write('1'.encode('ascii')) # on
tn.write('0'.encode('ascii')) # off
- Android phone (tested on 7.0 and 8.1)
- Arduino UNO
- LED
- USB Cable Type A/B
- OTG cable USB to micro-USB
- Arduino IDE
- Termux (F-Droid version)
- Server Bridge X
All code is available on github
-
On the PC, install Arduino IDE.
-
Connect Arduino UNO to PC using USB Cable Type A/B.
-
Upload sketch.ino to your Ardunio board using the Upload button in the Arduino IDE.
-
On the android smartphone, install Server Bridge X and Termux via F-Droid marketplace.
-
Open Android app Server Bridge X.
-
Attach OTG cable USB to micro-USB to Arduino. Press 'ok' when asked to Allow the app ServerBridgeX to access the USB device.
-
Press play in Server Bridge X.
-
Open Android app Termux.
-
Connect smartphone to same network as PC.
-
On Termux, install SSH tools and python via commands in
script.sh
. -
On the PC command line, access the smartphone terminal using SSH.
-
On PC command line, run Python.
-
On Python, run
send.py
commands. LED should turn on/off based on the command sent (1 or 0).