1 the role of my project is to work automated behaviour as it is an Bluetooth Attendence system
2. Basic role of Rpi board type 2
Rpi -
An Rpi is a hardware which is basically known as a small linux machine usually used by the professionals there
the device gives us the full athority to make it boot under the linux environment and could work as we need either by the Linux terminal or the GUI terminal that came under by the command named as 'startx'
The basic thing i need to perform in my project is to run the Rpi board as the linux terminal and to connect a BT Dongle so that it could fetch the Addr that is the unique identification taken by the Device this device can fetch it the main problem area that i foun there was given Below:
a. How to boot it as to make it work as a linux machine..??
b. How to install it with out a view that is I dont have the sufficient resources..??
c. How to make it worked under the same laptop running Linux machine.. the real challange..??
d. How to install the bluez library..??
These were the main problematic areas for me.. I will describe then one by one and also provide the solution of it..
a. The initial task of the Rpi Type 2 Board.
the simple thing is to juzz open yout internet browser and download the Raspbian image to boot. And dont you do the same mistake i did. I firstly downloaded NOObs image for the board but it is applicable when we have a saparate monitor and keyboard with us.
But here the case was just opposite. We have a board and a laptop with us and so we could not find the real path to operate the Rpi, the Main challenge as i described above.
So just down load the image of Raspbian for the Pi and make it copy to the SD card for boot. Now As if you extract the downloaded folder with you Just copy and paste it there in the SD card.
And give up the ip Addr to the Pi board .
So open file named 'cmdtext.line' and edit it and write a line at the end.
ip=192.168.3.14
This line means that you gave a ip addr to the Pi board.
nOw remove it and insert into Rpi and Boot it...!!
As now the 3 leds will be blinking all the time and the will blink and says that the boot is performd :)
No as the boot performed Take a Ethhernet Cable and insert both male connector to the side of your laptop and Rpi board.
it means we are goin to use Laptop's display as the Rpi's Display and laptop Keyboard as Rpi's keyboard.
Now the thing we are going to use is SSH
firstly give up an ip address to the Laptop's terminal and then try the laptop to fetch the Rpi through the Rpi addr.
ip addr add 192.168.3.1/14 dev eth0
this line in CMD line give the laptop an static ip Addr
And now we use the command in linux new terminal SSH pi@192.168.3.14
It will make a tunnel and will connect to you to your Rpi terminal line over the Same Laptop Remotely.
now we have full athunication on our Rpi and we can work over it now with linux terminal.
Now the Third problem Arises, That is How do i connect with internet to pi?
so i googled a lot of stuffs and got a fantastic solution that was to use my laptop as a router and use the Internet connected here with Pi.
For this we have to firstly Give a static Ip address to the Rpi and to Our Linux machine.
(we had given it previously)
And then we have to provide the route internet to Pi.
so firstly i Up the certain flags:
sudo iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
These tell the packet filtering mechanism what to do with certain types of packets. The first one says to accept packets which are starting a new connection and coming from 192.168.1.* over eth0, and forward them over wlan0. The second says to also forward packets coming from an established connection or at least a connection related to an established one. I think the third rule says that when we're forwarding packets, we pretend to the computer at the other end (e.g. a web server) that we're the original source, and when it replies we forward that reply to whoever really sent the original packet (in this case, the Pi).
Now we need IP forwarding on laptop type this command
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
/proc is a virtual filesystem used for communicating with the kernel. Writing 1 to that file is like pressing a button labelled "IP forwarding"
Now we have to up the network that is enable whole setup.
sudo ifconfig eth0 up
This make sure that your laptop to listen to the packets
In Rpi add the Static ip address on command line
sudo ip addr add 192.168.1.2/24 dev eth0
this make the limit or the boundation to the Rpi for making connected itself in the limit of /24
then make the Rpi to where to find the internet
sudo ip route add default via 192.168.1.1
Now at here we are ready to use internet now to check ping the terminal, we are not configures to DNS so ping google.com will not work, so use ping 173.194.36.6 this is the ip address of google.com
Now to make DNS working edit the file
/etc/resolv.conf
and add line
nameserver 208.67.222.222 208.67.220.220
At this point you have internet running on Rpi
try pinging
Ping Google.com
And its what we need to be done.