Setting up the Zybot Server

Now that we have our Zybot set up and the firmware installed, we can set up our server script and get our webcam working! This is part of the Zybot collaboration, so be sure to check out the other Instructables. The previous instructable is here. (Setting Up the Zybot-Software)

The plan for this Instructable is to have the webcam send a "video" to an IP address. That way a computer that's on the same server can view what the robot sees.

Note: If you have your WIFI adapter plugged in, be sure to unplug it while your are connected to the Ethernet Cable.

Open up your terminal, and enter the commands:

sudo apt-get update

sudo apt-get install linux-firmware motion

Step 1: Putting the files into Home

Setting up the Zybot Server

When you boot up your ZYBO and it gets to the main screen, a disk symbol should pop up, this is the ZYBO_BOOT partition in the Micro SD card. Open up your folders and drag and drop files.zip into the Home folder. Then extract into home.

Step 2: Building your server and motion file

Now that the Micro SD card is plugged back into the ZYBO, we want to build server.cpp.

  • Press CTRL+ALT+t on the keyboard to open up a terminal
  • In the terminal, enter the command cp files/server.cpp Document/server.cpp
  • Enter the command cd Documents
  • Run g++ server.cpp -o server
  • This will generate the executable file that our script will use. Build server.cpp.
  • gcc usbreset.c -o usbreset
  • This code will reset the usb that is attached to the WIFI Adapter.

    Step 3: Replacing the motion.conf file

    Setting up the Zybot Server

    Now we are going to replace our motion file. To do this we want to run the following commands:

  • cd
  • This will take us back to the base directory
  • sudo rsync -a files/motion/motion.conf /etc/motion/motion.conf

    This will change the motion.conf to transmit to a specified web address. To find this web address enter the command ifconfig.

    Look for the wlan0 line, then the inet addr: line and that will give the IP address to use. Now you can go onto any Firefox browser and enter that IP address (add :8081 at the end of the address) and see what your Zybot sees.

    Step 4: Putting the server_script file into init.d

    The last thing we want to set up is the script. Just like replacing the motion file, all we have to do is run rsync again.

  • sudo rsync -a files/server_script /etc/init.d/server_script

    This will create a copy of the server_script file and place it into init.d.

    Step 5: Building everything

    Setting up the Zybot Server

    The last thing we have to do is update everything, that way all the changes we made will take effect.

    Run the following commands:

  • chmod +x /etc/init.d/server_script
  • This will change server_script into an executable file. Before chmod, we couldn't use server_script with anything.
  • update-rc.d -f server_script defaults
  • Here we add the server_script into the startup of our ZYBO. This runs the files we've added and will start the webcam and reset the WIFI adapter!

    Now restart your Zybo, and everything should be running!

    We can move onto the next Instructable in the collection! (Setting up the Zybot - Power Considerations)

  •  
     

    Tag cloud

    make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel