Skip to main content

Posts

Showing posts from February, 2015

Featured Post

Product Design of a 4 wheel differential drive robot

BeagleBoneBlack GPIO Push Button + LED

 

LED Cube using Atmega328P

GPIO Blink an LED using C - BeagleBoneBlack

First enable gpio23 and set it as output. echo 23 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio23/direction (Refer this page for circuit info.) Then compile this code and run it. There are two arguments to this code. One is the number of times the LED blinks and the other one is the delay in us.

GPIO Blinking an LED using bash script

Refer this site . This gives a fare idea about how to design a simple transistor switch. Or go to this site . The max o/p voltage from the gpio pin is 3.3 V. But you can get a 5V VDD from Beaglebone Black board. The circuit I designed is given below. The transistor I used is KN2222A . (You can use any transistor)   Will add a nice circuit diagram later. Once you are finished with the circuit follow the steps in this page . cd /sys/class/gpio echo 23 > export cd gpio23 echo out > direction Then save the script given below to a file and run this in your BBB. (It will blink the LED once every second.) Cntrl + C to stop the script.  

Getting started with GPIO (Testing GPIO with a multimeter)

There are 65 possible GPIO pins that you can control. Some of the GPIO pins are normally configured to different functions. Let's play with one of them. Go to the beaglebone website and figure out the header pin corresponding to gpio23. The gpio23 is mapped to the 13th header pin. In this tutorial we are testing the gpio23 output using a multimeter (Do not connect an LED directly to BBB IO pin). First go to following directory cd /sys/class/gpio / Then make gpio23 available echo 23 > export A new directory will be created. Open gpio directory. cd gpio23 The direction of IO will be normally set as in (input).  To make it as output, echo out > direction Then set the pin to high using echo 1 > value Measure the voltage at pin 13 of P8 header. If its 3.3 V then you are on the right track. Pin 1 and 2 will be ground. You can connect the negative terminal of multimeter to pin 1 or 2. To set output as zero, echo 0 > value After finished wit

BeagleBoneBlack apt-get upgrade error due to led-aging.sh

When I try to upgrade my new BBB bought from element14 (4gb emmc) it throws a list of errors. stem facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv:  loop involving service mountkernfs at depth 1 insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting led_aging.sh depends on rmnologin and therefore on system facility

Getting internet on BBB via usb (Share internet from your linux machine)

Login to your BBB and type route add default gw 192.168.7.1 Then type the follwing in your linux machine to route the network. sudo su iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface eth1 -j ACCEPT  echo 1 > /proc/sys/net/ipv4/ip_forw ard Note: eth0 is LAN interface which has internet connectivity. eth1 is the usb network connection with BBB. 192.168.7.1 is the ip address that assigned to your PC. Following part is not needed if internet is working properly. If you are using network that doesn't allow third party dns server (like google dns 8.8.8.8 or 8.8.4.4), you had to configure /etc/resolv.conf. First find out what dns server address your internet provider (your college) gives you. If you have a working network type nm-tool to find out the dnsaddress. Then delete all the entries in /etc/resolve.conf and replace it with nameserver <dnsaddr> eg: nameserver 192.168.0.5

Remote access your BeagleBone Black using vnc

Before going into how to share desktop with your BBB I assume you have a proper ssh access to your BBB. (through USB) (if not read this ) Also this tutorial is for BBB with Debian installed (type cat /etc/*-release to know which distro you are currently using. Or refer here ) First install the vnc server in BBB.(After logging into BBB) ssh root@192.168.7.2 apt-get install x11vnc Then go to your local computer and open a terminal window. Install a vnc viewer like vinagre. sudo apt-get install vinagre Now its time to start vnc server in BBB. x11vnc -auth /var/run/lightdm/root/:0 -forever This will start a vnc server at port 5900. Note this server setup is temporary. If you want to remotely connect to your BBB after a reboot type the above command again. Go to your local computer and type  vinagre 192.168.7.2::5900 A remote desktop will be shown if all goes well. Try exploring other options in x11vnc using (in BBB) man x11vnc The se

Program BBB using C (Blink onboard LED)

If you are familiar with linux, you may know that everything in linux is a file. You can talk to a hardware as if you are writing to a file. There are 4 on board LEDs in BBB. You can play with that LED. Go to /sys/class/leds/beaglebone:green:usr3/ cd /sys/class/leds/beaglebone:green:usr3/ If you write a '1' to the file corresponding to LED3, then it will light that LED. Writing '0' will switch off the LED. echo 1 > brightness It will switch on the LED forever. :-) If you want to switch off it again type echo 0 > brightness Let's do it in c. First ssh into your BBB (refer here ). Then create a directory to work with. mkdir helloworld cd helloworld Open your favourite texteditor. nano LEDBlink.c Then type this program. #include<stdio.h> int main() {         FILE *LEDHandler=NULL;         char *LEDPath="/sys/class/leds/beaglebone:green:usr3/brightness";         if(LEDHandler=fopen(LEDPath,"r+")){             

Getting started with BeagleBone Black (Remote login via SSH with Linux / Windows)

Just started working with beaglebone black Rev C. As I move on with beaglebone black I will keep my blog posted. It may be helpful for newbies like me... :-) Connect your BBB (BeagleBone Black) with your PC. Open up your terminal and type ifconfig to check whether it's connected. You will see an eth1 (ethx) connection with an IP assigned as 192.168.7.1 When you connect your BBB, you will see a drive mounted up (if not mount the disk). Open the drive and open start.htm. You will see documentation of the device there. You can install drivers from there. (Driver installation isn't required, but you might find a few udev rules helpful.) Just download the mkudevrule.sh file. Go to the folder where you download the file. Then give permission to execute the file. cd ~/Downloads/ chmod +x mkudevrule.sh Then run it by, sudo ./mkudevrule.sh In orded to remotly login to your BBB using ssh type ssh root@192.168.7.2 There won't be any root password set yet. For win