# Control smartphone camera with Node red installed on Android

**URL:** <https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089>\
**Category:** General\
**Created:** [24 October 2019 13:15 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089 "2019-10-24T13:15:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [24 October 2019 13:15 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/1 "2019-10-24T13:15:55Z")

</div>

Hey there,

I want to control my smartphone camera and taking pictures via node red.  
But I have no idea how to fix this that Node red communicates with my smartphone camera.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [24 October 2019 13:25 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/2 "2019-10-24T13:25:36Z")

</div>

Hi,  
What have you tried so far, and what research have you done into it/what info did you find?

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [24 October 2019 13:40 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/3 "2019-10-24T13:40:28Z")

</div>

I only get the information that it should works with the exec node and the information at the node red website  
([https://nodered.org/docs/getting-started/android](https://nodered.org/docs/getting-started/android))

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [24 October 2019 13:56 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/4 "2019-10-24T13:56:21Z")

</div>

Okay, based on that link I'm going to assume that you are running Node-RED from Termux, on an android device, and that you'd like to use the builtin camera to take a photo through the exec node. If you follow a few of the links it mentions a termux API addon, that if installed through Termux it will expose a number of commands to the terminal. Because the exec node is used to execute commands on the local system, that's how you would use it.  
[https://wiki.termux.com/wiki/Termux-camera-photo](https://wiki.termux.com/wiki/Termux-camera-photo)  
The `termux-camera-photo` command seems most suitable for what you are planning to do based on your first post. However, that is all the information I can find either.

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 06:13 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/5 "2019-10-25T06:13:31Z")

</div>

I tried this command but I it still happens nothing..

Here's my flow

```auto
[
    {
        "id": "87f59d07.c87308",
        "type": "exec",
        "z": "235ac48f.9a1b34",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "",
        "x": 730,
        "y": 100,
        "wires": [
            [
                "37df8933.ebd266"
            ],
            [
                "74325d34.2e9174"
            ],
            [
                "788f6223.416694"
            ]
        ]
    },
    {
        "id": "e3658cd0.4085a",
        "type": "inject",
        "z": "235ac48f.9a1b34",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 280,
        "y": 100,
        "wires": [
            [
                "165a3a77.a2f3ae"
            ]
        ]
    },
    {
        "id": "165a3a77.a2f3ae",
        "type": "function",
        "z": "235ac48f.9a1b34",
        "name": "",
        "func": "msg.payload = \"termux-camera-photo test.jpg\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 490,
        "y": 100,
        "wires": [
            [
                "87f59d07.c87308"
            ]
        ]
    },
    {
        "id": "37df8933.ebd266",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 80,
        "wires": []
    },
    {
        "id": "788f6223.416694",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 160,
        "wires": []
    },
    {
        "id": "74325d34.2e9174",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 120,
        "wires": []
    }
]

```

And this is what I get on the output..

> **Picture**
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/600f629de8bbbc0bbd53b2deaa13913f6050c44d.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 08:08 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/6 "2019-10-25T08:08:26Z")

</div>

What command do you think the exec node is running?  
Put a debug node on the output of the function node and see what it shows.

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 08:24 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/7 "2019-10-25T08:24:27Z")

</div>

thougt this is the command for the exec: "termux-camera-photo test.jpg"

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 09:27 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/8 "2019-10-25T09:27:03Z")

</div>

If you run that in a terminal on the phone does it work?

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 09:28 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/9 "2019-10-25T09:28:54Z")

</div>

no doesn t work..

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 09:33 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/10 "2019-10-25T09:33:02Z")

</div>

Well that is the problem then. Nothing to do with node-red.  
How do you know it is not working?

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [25 October 2019 09:42 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/11 "2019-10-25T09:42:50Z")

</div>

Have you installed the Termux API addon? If not, start there. If yes, what do you see in the terminal when you type that command by hand?

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 09:51 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/12 "2019-10-25T09:51:25Z")

</div>

I ve allready installed it..

It just shows noting and expect the next command

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 09:53 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/13 "2019-10-25T09:53:23Z")

</div>

What do you expect to see in the terminal when you enter the command?

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 09:55 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/14 "2019-10-25T09:55:02Z")

</div>

that a picture named test.jpg is generated

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 10:02 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/15 "2019-10-25T10:02:26Z")

</div>

I asked what you expect to see in the terminal. I don't see anything in the description of that command that says it will confirm that it has done it. The command has not shown an error so I would expect that it thinks it has done it.

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 10:04 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/16 "2019-10-25T10:04:37Z")

</div>

okay but if it do so where is the file?  
I mean I would like to take some pictures controlled by NR..

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 October 2019 10:08 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/17 "2019-10-25T10:08:30Z")

</div>

Presumably it is in the current directory. In the terminal, run `ls` to see if it is there.

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 10:21 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/18 "2019-10-25T10:21:21Z")

</div>

okay it is there, but how do i get the file then?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [25 October 2019 10:23 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/19 "2019-10-25T10:23:51Z")

</div>

There is file-in node in Node-RED have you tried that?

---

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [25 October 2019 10:27 UTC](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089/20 "2019-10-25T10:27:50Z")

</div>

no, cause i don t know at what file path the files are

[Next page](https://discourse.nodered.org/t/control-smartphone-camera-with-node-red-installed-on-android/17089.md?page=2)
