User Tools

Site Tools


en:remotecontrol

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:remotecontrol [2018/01/29 10:12] (current)
Line 1: Line 1:
 +==== Access thru internet by BBB with VNC ====
 +If you want to communicate with arduino over internet one of almost "​painless"​ solution is the use of in-between miniPC. It can be found a lot of linux distribution on miniPC whichp provide us a lot of useful tools which can make our goal easy-achievable.  ​
  
 +In next few paragraphs there is a brief guide for realizing connection between arduino and PC over internet. As intermediator serves [[http://​beagleboard.org/​Products/​BeagleBone%20Black|BeagleBone Black]] with Ubuntu. We will use [[http://​cs.wikipedia.org/​wiki/​VNC|VNC]] and [[http://​cs.wikipedia.org/​wiki/​Virtu%C3%A1ln%C3%AD_priv%C3%A1tn%C3%AD_s%C3%AD%C5%A5|VPN]] by Hamachi.
 +
 +Guide has these steps:
 +  * Upload Ubuntu on SD card
 +  * Install and configurate VNC server and graphical interface
 +  * Install arduino IDE
 +  * Install Hamachi client
 +
 +== Upload Ubuntu on SD card ==
 +At first it is need to download required version of Ubuntu for ARM architecture. I use 13.04 Raring version, which can be found [[http://​s3.armhf.com/​debian/​raring/​bone/​ubuntu-raring-13.04-armhf-3.8.13-bone20.img.xz|here]]. ​
 +
 +File is archive image file. It first we must extract them and after that upload to SD card.
 +
 +Linux:
 +<​file>​
 +tar xvJf ubuntu-image-file-archive.img.xz
 +umount /dev/sdX
 +dd if=/​path/​to/​yours/​ubuntu-image-file.img.xz of=/​dev/​sdX ​
 +# don't forget substitude sdX by yours SD card address ​
 +</​file>​
 +
 +Windows:
 +For unpacking use the 7-zip or similar and for writing the image on SD card Win32 Disk Imager may serves.
 +
 +After pluging SD to BBB and it's turn on will the system begin to boot from SD card. \\
 +//*note. I found the information on the internet that if one want to boot from SD card one must press and hold BOOT button on BBB. If I do it it never boots. So maybe I do no understand it corectly or somethink has changed. My BBB is REV3B.//
 +
 +== Install and configurating VNC server and graphic interface ==
 +If you successfully boot the worst is behind you. But before we can connect to arduino over interne it's necessary to install some packages and configurate VNC server and hamachi client.
 +
 +If you have got microHDMI cabel, you can plug your BBB directly to your monitor and use usb keyboard. If you do not have HDMI cabel plug ethernet cabel to your BBB and connect it to your home net or directly to your PC. In Ubuntu it runs dhcp client so it won't be problem to put into operation communication and use SSH protocol to get in. \\
 +username: ubuntu \\
 +password: ubuntu \\
 +//*note. If you have got problem with LDXE display manager and after logging it will stay just color of background on screen, you can disable the calling of display manager after logging by this command:''​$echo "​false"​ | sudo tee /​etc/​X11/​default-display-manager''//​
 +
 +
 +You will need internet connection for next steps.\\
 +At the first update your system:
 +<​file>​
 +apt-get update
 +apt-get upgrade
 +</​file>​
 +
 +In next step install VNC client with LDXE support. This solutin were taken from this pages: [[http://​www.vandorp.biz/​2012/​01/​installing-a-lightweight-lxdevnc-desktop-environment-on-your-ubuntudebian-vps/​|www.vandorp.biz]]
 +<​file>​
 +apt-get install xorg lxde-core tightvncserver
 +</​file>​
 +
 +Next run the VNC client. It will generate it's config file. After that you can turn it off.
 +<​file>​
 +tightvncserver :1
 +tightvncserver -kill :​1  ​
 +</​file>​
 +
 +Open the config file of VNC client: ​
 +<​file>​
 +nano ~/​.vnc/​xstartup
 +</​file>​
 +And apend this line there:
 +<​file>​
 +lxterminal &
 +/​usr/​bin/​lxsession -s LXDE & 
 +</​file>​
 +This will provide you that after conecting to VNC server it will drop you right into LDXE graphical interface.
 +
 +Now you can turn on VNC server again. And if you want you can add it to services run on start of the system (Guide is taken from this blog [[http://​www.abdevelopment.ca/​blog/​start-vnc-server-ubuntu-boot|www.abdevelopment.ca]]). At the first you need to make a script turning on the VNC server in folder /​etc/​init.d/ ​
 +<​file>​
 +nano /​etc/​init.d/​vncserver
 +</​file>​
 +
 +Put this lines into the file and save it:
 +<​file>​
 +#!/bin/sh -e
 +### BEGIN INIT INFO
 +# Provides: ​         vncserver
 +# Required-Start: ​   networking
 +# Default-Start: ​    3 4 5
 +# Default-Stop: ​     0 6
 +### END INIT INFO
 +
 +PATH="​$PATH:/​usr/​X11R6/​bin/"​
 +
 +# The Username:​Group that will run VNC
 +export USER="​ubuntu"​
 +#${RUNAS}
 +
 +# The display that VNC will use
 +DISPLAY="​1"​
 +
 +# Color depth (between 8 and 32)
 +DEPTH="​16"​
 +
 +# The Desktop geometry to use.
 +#​GEOMETRY="<​WIDTH>​x<​HEIGHT>"​
 +#​GEOMETRY="​800x600"​
 +GEOMETRY="​1024x768"​
 +#​GEOMETRY="​1280x1024"​
 +
 +# The name that the VNC Desktop will have.
 +NAME="​my-vnc-server"​
 +
 +OPTIONS="​-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :​${DISPLAY}"​
 +
 +. /​lib/​lsb/​init-functions
 +
 +case "​$1"​ in
 +start)
 +log_action_begin_msg "​Starting vncserver for user '​${USER}'​ on localhost:​${DISPLAY}"​
 +su ${USER} -c "/​usr/​bin/​vncserver ${OPTIONS}"​
 +;;
 +
 +stop)
 +log_action_begin_msg "​Stoping vncserver for user '​${USER}'​ on localhost:​${DISPLAY}"​
 +su ${USER} -c "/​usr/​bin/​vncserver -kill :​${DISPLAY}"​
 +;;
 +
 +restart)
 +$0 stop
 +$0 start
 +;;
 +esac
 +
 +exit 0
 +</​file>​
 +
 +Now set the bootability flag to the file and add VNC server to services to services to run at startup.
 +<​file>​
 +chmod +x /​etc/​init.d/​vncserver
 +update-rc.d vncserver defaults
 +</​file>​
 +
 +So now it is possible ro connect to your BBB from another PC directly to graphical interface.
 +
 +== Instalalling arduino IDE ==
 +Arduino package can be found in ubuntu repository, so it's only one command to install it.
 +<​file>​
 +apt-get install arduino
 +</​file>​
 +
 +After install and connecting arduino thru USB cabel to BBB there is in /dev folder ?can't remeber the name of this file type? file for your arduino /​dev/​ttyACM0.
 +
 +If you want the access to this file without root permissions,​ you will have to add you into dialout group.
 +<​file>​
 +sudo usermod -a -G dialout ubuntu
 +</​file>​
 +
 +So now you had got arduino IDE installed, so you can comminicate in program it as you do on your usual computer. But there is a problem (if you down have public IP address and you are shielded by your router before accessing from outside), that you can access your BBB in your local net. Solution will be in use of VPN, which makes an virtual private network. So you can connect any computer from outside which has an access to internet to your private network. For profit from advantage of VPN, without need of running VPN server on any of your computer, one can use hamachi. ​
 +
 +== Instaling and setting Hamachi client ==
 +
 +Guide can be found on this pages [[http://​gencarelle.com/​blog/​2013/​05/​31/​running-hamachi-on-a-beaglebone-black/​|gencarelle.com]]. Steps 9-19.
 +
 +Nice tutorial video on setting the client:
 +{{ youtube>​8ZgIgb3o_3Q }}
 +   
en/remotecontrol.txt ยท Last modified: 2018/01/29 10:12 (external edit)