Fast Video Streaming using Webcam and MJPG-Streamer Rasp-Pi

Posted in Electronics and Robotics, Embedded, Uncategorized with tags , , , on August 26, 2014 by satriant

Hello Semua,

kali ini I’d like to show you how to setup streaming with webcam,

after using motion as webcam server, I dont get satisfied its because the lag / latency.

 

this video streaming’ll be use into my private projects that needed video-streaming.

I found that the MJPG-streamer is the most suitable-non-lag-fast-streaming-video-server ever.

 

ok, just follow these steps ya :-* (centil banget hehe)

1. Install build dependencies

The following command installs the three libraries that MJPG-Streamer uses:

$ sudo apt-get install libjpeg8-dev imagemagick libv4l-dev

2. Add missing videodev.h

The videodev.h header file that MJPG-Streamer needs has been replaced with a videodev2.h. To make MJPG-Streamer happy you have to create a symbolic link:

$ sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

3. Download MJPG-Streamer

The source code for MJPG-Streamer is available at sourceforge.net, but it is tricky to find the direct download link:

$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip

4. Unzip the MJPG-Streamer source code

The source code download is a compressed zip file. Put the file in your home directory (or a temporary folder, if you prefer) and run the following to extract the files:

$ unzip mjpg-streamer-code-182.zip

5. Build MJPG-Streamer

MJPG-Streamer comes with several plugins, but only a couple of them are needed to stream video. The command below only builds what’s needed:

$ cd mjpg-streamer-code-182/mjpg-streamer
$ make mjpg_streamer input_file.so output_http.so

6. Install MJPG-Streamer

The following commands copy all the needed files into system directories:

$ sudo cp mjpg_streamer /usr/local/bin
$ sudo cp output_http.so input_file.so /usr/local/lib/
$ sudo cp -R www /usr/local/www

7. Start the camera

We are almost there. Now it is time to start the camera module:

$ mkdir /tmp/stream
$ raspistill --nopreview -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &

Of course, you can use different options to raspistill if you like.

8. Start MJPG-Streamer

The camera is now writing images, so all that is left is to start MJPG-Streamer:

LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www"

9. Watch the Stream!

Now you can connect with your web browser and watch the stream live. If you want to watch from within the same Raspberry Pi you can enter http://localhost:8080 in the browser’s address bar. If you want to watch from another computer in your network use http://IP-address:8080.

10. Cleanup

After you verify that everything is working you can remove the source code:

$ cd ../../
$ rm -rf mjpg-streamer-182

Conclusion

untuk pertanyaan silahkan aja contact me at satria.nt@gmail.com

 

happy tryin’

On Goin’ my ‘iseng’ Projects

Posted in my extraordinary life on August 4, 2014 by satriant

ok, lebaran telah usai..ehehehe back to work, back to solder, tin and a lot of wires.

1. Arm-Robot 6-DOF / honestly this is my Master Degree Thesis, hehe

the target : there’s an alternative cheap industrial robot, made in Indonesia for sure.

Process : 30%

update :

a. Kinematics Modelling Done

b. Cad Done

 

2. Near Space Communication and Imaginery

the target : testing my own mini-computer board capability in free-fall area and extreme temperature. I’ll using Airmax for the communication link since its written on the datasheet that its support multiKM communication, all of the payload and communication link would be brought by helium ballon into stratosphere (if you didnt know about this please read wikipedia first.hehe).

Process : 1%

 

3. Drone-Army

yeah, replace all jets with unmanned air-fighter UAV and Spyin Plane

Process : 80%

update :

a. modelling kit using balsa

b. installing servo

c. testing ground control software

d. flight controller re-design

 

4. Rocket / Propellant

I started research about this after looking at Lapan Rocket, they using solid KNO3 or Potassium Nitrate + Sugar + Propellant Booster like metal dust. I think Indonesia must be active in research about this sector, not only for defense but also for attack, hehe… Hidup Indonesia Tanah Airku!!

Process : 10 %

update :

a. collecting information for regulation of developing military technology in Indonesia

b. looking for Chemistry Shop, hehe, di bogor banyak inimah.

 

ok, I’ll update periodically klo ada time, hehe

 

Pemuda yang hebat adalah pemuda yang peduli terhadap bangsanya!

 

INDONESIA! Rocks

 

selamat jalan masa remajaku

Posted in Uncategorized on July 20, 2014 by satriant

life as you know it..

finally i have to face the moment that usually everyone’ll do, yeah I think all of you would guess it easily. hehe…

I should have to think anything that more important than constantly thinking about my self, tommy a workaholic person who is always busy with his business now must to think how to build a great family.

-in silence

depok, july 2014

adb not running

Posted in Uncategorized on July 15, 2014 by satriant

The more common this problem, the solution is as follows:

1, Enter CMD into the DOS interface, enter the android-sdk-windows\platform-tools directory, execute the following command

Start ADB start-server
The following error occurred
* daemon not running. starting it now on port 5037 *
ADB server didn’t ACK
* failed to start daemon *

2, Execute the following command
adb nodaemon server
The following error occurred
cannot bind ‘tcp:5037′
The original ADB server port binding failed 

3, Enter the following command query which using port 5037
netstat -ano | findstr “5037”
The following information
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 1616

4, Open the task manager kill 1616 out of the process

5. Taskkill -pid 1616

Enabling Remote Access to MySql

Posted in programming with tags , , on February 12, 2014 by satriant

Hello Temans Temans…. this will remind me.. hehe

by default remote access to the MySQL database server is disabled for security reasons.
However, some time you need to provide remote access to database server from home or a web server.
This post will explain how to setup a user account and access mysql server remotely.

case-nya :

1. gw punya server di 240.125.xxx.xxx yang ada mysql-server database-nya

english: I have a mysql-server on 240.125.xxx.xxx

2. nah gw punya client tapi IP-nya dinamics, di pakenya di android, iOS dll

english: and the clients have dinamics IP-Address, that run on Android, iOS or Desktop App

3. gw mau akses / Query dari manapun. untuk menambah atau menghapus atau apapun pada record-nya

english: I wanna access that database or query from anywhere, for adding, remove record etc.

after, 5 minutes googling and confusing and make my head start to blow, I finally found a simple way to do this.

lets start!!!

Login to your Machine

assume that your machine is a *nix machine, you can do this from any-platform, from windows you can

access remotely by using putty ssh, from linux you can directly using ssh.

$ ssh root@240.125.xxx.xxx

Edit The “my.cnf” mysql Configuration File

you have to edit this file and add your public-IP on the following line :

# vim /etc/mysql/my.cnf

add this :

bind-address    = 240.125.xxx.xxx

and the rest of configuration file, should be look like this :

user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 240.125.xxx.xxx

Save and Close The File

you have to restart the mysql service

# /etc/init.d/mysql restart

Grant Access to Any Remote IP Address

example parameter :

Database  : myDatabase

User           : root

Password : password

remoteIP : ANY

 

connect and login to database :

# mysql -u root -p

enter this command :

# mysql> GRANT ALL ON myDatabase.* TO root@’%’ IDENTIFIED BY ‘password';

logout from mysql

# mysql> exit

ok, now you can try to access and remotely query or add or whatever you want to your database.

 

Thanks for Reading

Regards

Tommy Agustianto

current loop

Posted in System Control with tags , , , on January 27, 2014 by satriant

hai…

I’d like to explain about current loop which usually used in instrument and process control systems, remember… CURRENT LOOP not CURRENT LOVE, hahahahaha…stt… dont curcol on the blog please. hihi.

okeh..

1. what do you know about 4-20mA?

2. why we transmits a current not voltage?

3. how to measure a current loop?

4. how to generate a simple current loop from a microcontroller?

5. how its use? 4-wire? 2-wire?

6. what systems that applicable for this?

 

lets study one by one, I’m  not smart, but maybe I’m one step ahead from you.

CASE I

4-20mA :

First appearing in the 1950’s with the advent of electricaland electronic controls, the 4-20mA signal standard reigns
as one of the most popular mediums for signal transmission and electronic control in industrial environments nearly
60 years later, at that year Indonesia still playing sharp bamboo.

Prior to the widespread adoption of electrical and electronic controls, buildings often used pneumatic control
systems. Large and powerful compressors drove 3psi to 15psi pneumatic signals throughout a plant and these
pneumatic lines connected to pneumatically controlled valves and pneumatically controlling valves in order to drive
proportional controls and actuators throughout the building, all powered from compressed air. Air pressure at 3psi
served as the “live-zero” and 15psi represented 100%. In this way, the more modern 4-20mA signal standard
emulated the earlier 3-15psi pneumatic controls. Any pressure below 3psi was considered “dead zero” and an alarm
condition. Some installations still use pneumatic control today. Modern I/P converters (current-to-pressure
transducers) are available to convert the 4-20mA control loops to common pneumatic ranges, such as 3-15psi, 1-18psi, 3-27psi, and 6-30 psi.

now, lets see this triangle | relation between R.I.V R(Resistance)/I(Current)/V(Voltage).

Current Loop

From the triangle, I can quickly identify the three common components of a current loop, how they are wired together,
and even the direction of current flow. For my mental model, each side of the triangle represents a component of the
current loop. The vertices of the triangle represent a wired connection between these components. For reference, I
also place a positive/plus sign on the “peak” of the triangle. I will also use the first three letters of “TRIangle” to
identify the principle components. Accepting the convention that current flow will move from the supply positive to
and return to the supply negative, I see that current moves counter-clockwise in my symbolic current loop.

Thats enough for phase one, I’ll continue later…

 

Ied Mubarak 1434H

Posted in Uncategorized on August 16, 2013 by satriant

Selamat Hari Raya Idul Fitri 1434H

Mohon Maaf Lahir dan Batin.

Semoga Ramadhan Tahun dpn udah ganti status aminnn.

Follow

Get every new post delivered to your Inbox.