Built in webcam server working on my new N2

Discussions about ideaMaker and other printing software.
User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Tue Apr 10, 2018 7:48 pm

JoeyC wrote:That looks good. Did you try it after that? What error if any do you get in the browser?


On Chrome "This website is not available ERR_CONNECTION_REFUSED"
Machines Brand : Raise3D / Wanhao / BCN3D

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Tue Apr 10, 2018 8:11 pm

Are you sure of the IP address. What do you get when you do "ifconfig" on the tablet?

Do the "ps -ef | grep mjp" again to make sure the server is still running.

Does a ping from your PC to the tablet IP work?

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Tue Apr 10, 2018 8:25 pm

Ip of my printer is 192.168.0.26, I can't do a mistake I need to connect via SSH

When I do ifconfig :

Code: Select all

login as: root
root@192.168.0.26's password:
root@imx6qdlsolo:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 4C:53:1B:04:81:D4
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:50 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3782 (3.6 KiB)  TX bytes:3782 (3.6 KiB)

mlan0     Link encap:Ethernet  HWaddr 6C:AD:F8:EA:20:CC
          inet addr:192.168.0.26  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3713 errors:0 dropped:366 overruns:0 frame:0
          TX packets:2742 errors:4 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2446138 (2.3 MiB)  TX bytes:302083 (295.0 KiB)

root@imx6qdlsolo:~#



and "ps -ef | grep mjp"

Code: Select all

root@imx6qdlsolo:~# ps -ef | grep mjp
root     13754 13203  0 20:24 pts/0    00:00:00 grep mjp


Ping is Ok from my PC to 192.168.0.26 (my printer)

Code: Select all

Envoi d’une requête 'Ping'  192.168.0.26 avec 32 octets de données :
Réponse de 192.168.0.26 : octets=32 temps=102 ms TTL=64
Réponse de 192.168.0.26 : octets=32 temps=20 ms TTL=64
Réponse de 192.168.0.26 : octets=32 temps=42 ms TTL=64
Réponse de 192.168.0.26 : octets=32 temps=61 ms TTL=64

Statistiques Ping pour 192.168.0.26:
    Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%),
Durée approximative des boucles en millisecondes :
    Minimum = 20ms, Maximum = 102ms, Moyenne = 56ms
Machines Brand : Raise3D / Wanhao / BCN3D

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Tue Apr 10, 2018 9:00 pm

There are a couple of other things, but I need to check that the tablet has the commands i need. I'll take a look tonight.

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Tue Apr 10, 2018 9:30 pm

Ok, don't stress with that. Thank you for your help. In the meantime, I use a webcam with a usb extension of 5m.

thanks !
Machines Brand : Raise3D / Wanhao / BCN3D

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Wed Apr 11, 2018 1:57 am

Try "netstat -ln | grep 8080" This will show if you have anything listening on port 8080. On my machine I get:

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
tcp 0 0 :::8080 :::* LISTEN

I use Firefox so I also tried it with chrome, worked fine.

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Wed Apr 11, 2018 5:06 pm

JoeyC wrote:Try "netstat -ln | grep 8080" This will show if you have anything listening on port 8080. On my machine I get:

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
tcp 0 0 :::8080 :::* LISTEN

I use Firefox so I also tried it with chrome, worked fine.


When I type "netstat -ln | grep 8080"
only the command-line prompt is returned

Code: Select all

root@imx6qdlsolo:~# netstat -ln | grep 8080
root@imx6qdlsolo:~#

the port seem not in use
Machines Brand : Raise3D / Wanhao / BCN3D

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Fri Apr 13, 2018 10:04 pm

It looks like mjpeg-streamer did not start. You can manually start it and see if that works. Copy the lines you added to rc.local into a new file and make it executable. Thren try running it and see what error you get. That should tell us what's going on.

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Sat Apr 14, 2018 10:10 am

JoeyC wrote:It looks like mjpeg-streamer did not start. You can manually start it and see if that works. Copy the lines you added to rc.local into a new file and make it executable. Thren try running it and see what error you get. That should tell us what's going on.


Now, if I put manually this code :

Code: Select all

/usr/cam/bin/mjpg_streamer -i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" -o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &


I can view my cam on 8080 but I need to open SSH and put the code manually everytime, If I close SSH connection, server close it
Attachments
integrated-webcam-raise3d-n2-dual-plus-8080.jpg
Machines Brand : Raise3D / Wanhao / BCN3D

Jetguy
Posts: 2700
Joined: Tue Mar 22, 2016 1:40 am
Location: In a van, down by the river

Re: Built in webcam server working on my new N2

Postby Jetguy » Sat Apr 14, 2018 1:02 pm

If I close SSH connection, server close it

Correct, this is expected from Linux operating systems. You started a command as a user under a login. When you log out, all commands under that user instance stop.

That's why you need to complete the REST of the instructions to not start the streamer as a user- but at a system level at startup using a script. Since the "system" starts the task, it remains running regardless of what a user does (you logging in via SSH).

Where you have made a mistake is in step 5, this is what adds the streamer to start and not manually started by you a user logging in under SSH. Something is wrong here with how you did this step.
5. use nano to edit /etc/rc.local and add the following lines just BEFORE the line the says exit 0

/usr/cam/bin/mjpg_streamer \
-i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" \
-o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Sat Apr 14, 2018 8:22 pm

He's probably right, can you post the contents of your /etc/rc.local file?

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Sun Apr 15, 2018 8:46 am

Code: Select all

#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.


echo 30000 >  /proc/sys/vm/min_free_kbytes

amixer set 'Headphone' 118

echo 105 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio105/direction

echo 5 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio105/direction

echo 35 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio35/direction

echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction

echo 1 > /sys/class/gpio/gpio35/value
echo 0 > /sys/class/gpio/gpio36/value

/opt/Raise3D/MXCUI-start.sh

/usr/cam/bin/mjpg_streamer -i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" -o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &

exit 0


With these lines in "/etc/rc.local", on chrome I have this error on blank page :

Code: Select all

404: Not Found!
Could not open file


While when I put by ssh manually this code bellow the page is loaded on chrome

Code: Select all

/usr/cam/bin/mjpg_streamer -i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" -o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &
Machines Brand : Raise3D / Wanhao / BCN3D

firesped
Posts: 853
Joined: Mon Mar 21, 2016 9:23 pm
Location: Tucson, AZ

Re: Built in webcam server working on my new N2

Postby firesped » Sun Apr 15, 2018 11:36 am

the camera software for the raisetouch is there. I played with it using a modded xbox live camera and the software ran, as it was not configured properly it didn't show on the printer. likely the printer is looking for a spot and it need to be directed there and the camera app needs to be added to the boot script.

unfortunately at the same time, due to raise going with an embedded linux that can't be updated, your likely going to run into problems.
RL name: Michael Nolen
printers:
raise3D N2 kickstarter Early Bird
Trinus Deluxe (running smoothieware on Azteeg X5 GT board)
Monoprice Maker Select v2

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Tue Apr 17, 2018 2:31 pm

easysofts, try putting the lines in the rc.local file the same way I did as three lines. Maybe your hitting an issue with the line length?

/usr/cam/bin/mjpg_streamer \
-i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" \
-o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &


firesped,
I don't think we are using the raisetouch camera software. It looks like they tried using mjpeg-streamer and just left on there. But, I could be wrong.

User avatar
easysofts
Posts: 20
Joined: Thu Mar 22, 2018 3:27 pm
Contact:

Re: Built in webcam server working on my new N2

Postby easysofts » Tue Apr 17, 2018 2:51 pm

JoeyC wrote:easysofts, try putting the lines in the rc.local file the same way I did as three lines. Maybe your hitting an issue with the line length?

/usr/cam/bin/mjpg_streamer \
-i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" \
-o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &


Hi JoeyC
If I copy/past this 3 lines with nano in /etc/rc.local, reboot machine, and I type url of this printer 192.168.0.26:8080, I have this error message on Chrome

Code: Select all

"This website is not available ERR_CONNECTION_REFUSED"


If I copy/past the code in 1 line with nano in /etc/rc.local, and reboot machine and type url of printer, I have this error message on Chrome

Code: Select all

"404: Not Found!
Could not open file"


If I start manually the server by this code (in 1 line) by ssh, I can view my cam on 8080

Code: Select all

/usr/cam/bin/mjpg_streamer -i "/usr/cam/lib/input_uvc.so -d /dev/video0 -y -r 640x480 -f 10 -q 85" -o "/usr/cam/lib/output_http.so -p 8080 -w /usr/cam/www" &


Problem with special characteres "" or \ backslash in forum ? I don't understand where is this problem
Machines Brand : Raise3D / Wanhao / BCN3D

mb300sd
Posts: 34
Joined: Fri Mar 30, 2018 7:22 pm

Re: Built in webcam server working on my new N2

Postby mb300sd » Wed Apr 18, 2018 4:51 am

You can get far better video quality if you remove -y from the command line. That puts the camera into YUV mode and then mjpeg-streamer has to convert back to MJPEG. Removing it allows the camera to handle MJPEG encoding. I don't know why it's there in the first place.

I'm running at 1080p30 in native MJPEG mode with 90% less CPU usage then 640x480@10 in YUV mode.

Code: Select all

/usr/cam/bin/mjpg_streamer -b -i "/usr/cam/lib/input_uvc.so -d /dev/video0 -r 1920x1080 -f 30" -o "/usr/cam/lib/output_http.so -p 80 -w /usr/cam/www"


-b tells it to run in the background. I added that line to rc.local before exit 0.
Last edited by mb300sd on Wed Apr 18, 2018 5:02 am, edited 2 times in total.

mb300sd
Posts: 34
Joined: Fri Mar 30, 2018 7:22 pm

Re: Built in webcam server working on my new N2

Postby mb300sd » Wed Apr 18, 2018 4:58 am

Run "v4l2-ctl --list-formats-ext" to get a list of the modes your camera supports. You want one that lists "Pixel Format: 'MJPG' (compressed)" so the tablet's CPU doesn't have to do video conversion.

Maybe Raise3D had issues releasing the camera because of high CPU usage? Could be possible since they left the -y switch in there.

JoeyC
Posts: 21
Joined: Tue Mar 13, 2018 5:57 pm

Re: Built in webcam server working on my new N2

Postby JoeyC » Wed Apr 18, 2018 2:25 pm

@easysofts - The 404 error means that it can't find the index.html file. that's what leads me to think it could be a line length issue, the web dir is the last thing on the line. You should have no issues using the three lines so long as the '\' char is the last thing on the first two lines.

@mb300sd - The 'y' option is there because the sub $10 webcam I used does not support mjpeg. If yours does, then yes, that would be a good performance gain. Also the '&' at the end of the line should have the same effect as -b.

Even though I have this working, I'm still looking into using a Pi for the webcam so I can shutoff power to the printer if something goes wrong or after it's done.


Return to “Software”

Who is online

Users browsing this forum: No registered users and 6 guests