Skip to content

Arduino Gas range monitoring

While using gas range, busy mom can easily forget it.

So,  I made Arduino Gas range monitoring prototype.

When gas range works, Arduino flame sensor will watch on it.

  • If Arduino motion sensor recognizes there is no one near, it will beep periodically.

Anytime, if Arduino gas sensor works, it will beep also.

Arduino pro board is powered from USB Type A female connector plus AC-DC adapter.

After I test this prototype in real environment, I’ll add comments.

IMAG0136

prototype(MQ-2 Gas sensor, HC-SR501 motion sensor, SEN040129 flame sensor)

d0009977_576f346e9c161

Arduino flame sensor test

Arduino Bicycle Approach Warning System

I enjoy riding a bicycle in Han-gang(Han river in Seoul Korea).

1465637271303

When passing another bicycle, someone uses a bicycle bell or his own voice(i.e. Excuse me!). But many including me want to pass quietly. Actually it’s dangerous in narrow road.

So, I need a bicycle approach warning system. Garmin did it! but it’s aim seems to be on road.

Arduino supersonic sensor senses objects up to about 4 meters. So, I started to assemble Arduino parts.

IMAG0112

When a bicycle approaches behind me(min 50cm ~ max 4m, towards me), Arduino passive buzzer will play some melody.

Arduino pro mini accepts 9V DC through RAW pin. Supersonic sensor’s power consumption is about 0.5A/5V, so I need to check battery capacity.

When connecting Arduino pro mini using USB-to-Serial board, program uploading failed asserting ‘skt500-getsync’ error. After searching Google, I found that when uploading begins pressing reset button on Arduino pro mini board does help.

I bought the case which has a space for 9V battery  and managed to put above things in it.

IMAG0118

Tomorrow, I’ll test whether this scenario works or not.

[19 June, 2016]

  • It didn’t work. It can detect only a wall or a fence approaching.🙂
  • There are several problems.
  • First, 9V battery ran short within two hours. I will change Arduino board which has microUSB port and use 5,000mA rechargeable battery pack.
  • Second, a supersonic sensor covers small horizontal range as you can see in youtube video – Arduino Radar Project(https://youtu.be/kQRYIH2HwfY). So, I bought servo motor.
  • Third, polling interval should be reduced(one second -> 100ms or else) because another bicycle runs faster than I thought.

[26 June, 2016]

  • I added a servo motor to rotate supersonic sensor(will check another rider left behind me).
  • I changed from Arduino Pro to Arduino Nano, it’s power is from external battery pack(2,200mA, 1A/5V output).
  • But, supersonic sensor reported wrong distance because Nano can’t supply over 500mA. Supersonic sensor requires about 500mA, so power should be supplied directly to supersonic sensor. => 28 June, this is wrong. not 500mA but 15mA.

IMAG0122

[06 July, 2016] 

  • Now I connect additional power for Servo motor. GND pin is shared with two power source.
  • It works fine, but some modifications are needed.
  • Based my forward direction, the device monitors between 6 and 8 o’clock direction. But rotational speed is not enough, so can’t detect fast passing rider.
  • Considering power consumption and durability, non-rotational 7 or 7.5 o’clock direction of supersonic sensor will be fine.
  • To avoid useless warning when driving narrow road, it will be helpful to limit left warning distance to maximum supersonic distance * 0.5(0.5 = cosine(60 degree)).

No signal after self repairing iPhone4

I only replaced broken LCD of my iPhone 4 with new one.

But 3G service isn’t available anymore. I’m so panic, but the following link helped me.

After soldering one point, magically there was no problem with 3G service. 

http://s1130.photobucket.com/user/nguyen6453/media/noservice.jpg.html

AOC E1649FWU 16″ USB-Powered Portable with Raspberry Pi

My old post – https://imkiyoung.wordpress.com/2012/09/18/raspberry-pi-and-aoc-e1649fwu-usb-powered-led-monitor/
 cymera_20120921_113527

AOC E1649FWU 16″ USB-Powered Portable has no HDMI connector but USB 2.0 Y type cable(one is for additional 500mA power).

This article is written based on 2014-06-20-wheezy-raspibian.img.
To use AOC E1649FWU monitor with Raspberry Pi, there are somethings to do.
1) Prepare Raspberry Pi board and install Raspibian. Using Win32DiskImager, write Raspibian image to SD card. 
http://www.raspberrypi.org/downloads/ -> RASPIBIAN download
2) After writing SD card using Win32DiskImager & 2014-06-20-wheezy-raspibian.img, you can see file list as below.
bootcode.bin
cmdline.txt
config.txt
fixup.dat
fixup_cd.dat
fixup_x.dat
kernel.img
start.elf
start_cd.elf
start_x.elf
issue.txt
LICENSE.oracle
3) By default, Linux kernel of Raspibian does not support DisplayLink USB Framebuffer. So we are about to build new kernel image which supports DisplayLink USB Framebuffer. You can build Linux kernel on Raspberry Pi board. But it will take half of a day or more. So, I will use Ubuntu Linux running on VMware Player(Free for personal usage).
4) On Ubuntu linux, first get the same version of Linux kernel as Raspibian image.  After one or more hours, you can see ‘linux’ folder.
——————
im@ubuntu:~/Raspibian-2014-06-20$ git init
Initialized empty Git repository in /home/im/Raspibian-2014-06-20/.git/
im@ubuntu:~/Raspibian-2014-06-20$ git clone –depth 1 git://github.com/raspberrypi/linux.git
——————
5) On Ubuntu linux, prepare cross-compiler and tools.
——————
im@ubuntu:~/Raspibian-2014-06-20$ apt-get install gcc-arm-linux-gnueabi make ncurses-dev
im@ubuntu:~/Raspibian-2014-06-20$ git clone https://github.com/raspberrypi/tools.git
——————
6) For Kernel building,
——————
im@ubuntu:~/Raspibian-2014-06-20$ cd linux
im@ubuntu:~/Raspibian-2014-06-20/linux$ make mrproper
im@ubuntu:~/Raspibian-2014-06-20/linux$ cp arch/arm/configs/bcmrpi_defconfig .config
im@ubuntu:~/Raspibian-2014-06-20/linux$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig
——————
7) On Ubuntu linux, refer to next images. Press ‘Y’ when DisplayLink is selected, ‘M’ will be appeared.
8) My Ubuntu has two cores, so ‘-j3′(the number of cores on your system plus one).
——————
im@ubuntu:~/Raspibian-2014-06-20/linux$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j3
——————
9) Build modules.
——————
im@ubuntu:~/Raspibian-2014-06-20/linux$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-modules
im@ubuntu:~/Raspibian-2014-06-20/linux$ mkdir ../modules
im@ubuntu:~/Raspibian-2014-06-20/linux$ make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/
im@ubuntu:~/Raspibian-2014-06-20/linux$ cd ../tools/mkimage/
im@ubuntu:~/Raspibian-2014-06-20/tools/mkimage$ ./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image
——————
10) Finally, you can see kernel.img.
——————-
im@ubuntu:~/Raspibian-2014-06-20/tools/mkimage$ ls -l 
total 6264
-rw-rw-r– 1 im im     157 Jul 24 06:38 args-uncompressed.txt
-rw-rw-r– 1 im im     201 Jul 24 06:38 boot-uncompressed.txt
-rw-rw-r– 1 im im   32768 Jul 24 08:19 first32k.bin
-rwxrwxr-x 1 im im     822 Jul 24 06:38 imagetool-uncompressed.py
-rw-rw-r– 1 im im 6366188 Jul 24 08:19 kernel.img
——————-
11) And compress modules folder as one file for convenience of copying. You can see modules.tar file after below commands.
——————-
im@ubuntu:~/Raspibian-2014-06-20/tools/mkimage$ cd ../.. 
im@ubuntu:~/Raspibian-2014-06-20$ tar cvf modules.tar modules 
——————-
12) Now, we need to copy kernel.img file and modules folder to SD card. To avoid confusion, I will copy these after booting Raspberry Pi and connecting to it with WinSCP and Putty software.
13) Insert SD card and connect HDMI monitor to Raspberry Pi board and power up. Also you need keyboard and mouse.🙂
-Login : pi
-Password: raspberry
14) On Raspberry Pi console(maybe it’s your HDMI monitor), there may be a popup menu.(or sudo raspi-config)
-You might want to select “Expand Filesystem”.
-Please enable SSH.
-Reboot(or sudo reboot at console)
15) After rebooting Raspberry Pi, install WinSCP and putty.exe to your Windows based computer. Or you need Secure FTP and Secure Telnet software for your desktop OS.
16) Using WinSCP, connect Raspberry Pi and copy kernel.img(see 10) and modules.tar(see 11) to home(default user’s) folder of Raspibian.
17) On Raspberry Pi console, following command will overwrite existing system files, so if you want, backup them first.
———————–
pi@raspberrypi ~ $ tar xvf modules.tar 
pi@raspberrypi ~ $ cd modules/lib 
pi@raspberrypi ~ /modules/lib $ cp -r * /lib
pi@raspberrypi ~ /modules/lib $ cd 
pi@raspberrypi ~ $ sudo cp kernel.img /boot
pi@raspberrypi ~ $ sudo shutdown -h now
———————–
18) Raspberry Pi cannot supply enough USB power to AOC monitor. So, External Powered USB 4 port Hub may be required.
-connect your keyboard, mouse and AOC monitor’s USB Y cable to your 4 port Hub
-connect USB 4 port Hub(External DC powered) to Raspiberry Pi.
-connect HDMI monitor also. -> Because for now you cannot see anything on AOC monitor.
19) After login to Raspberry Pi,
————————
pi@raspberrypi ~ $ sudo con2fbmap 1 1 
————————
20) Can you see any character on AOC monitor? If not, something is missing or USB Hub problem. For me, screen was not clear. It’s like video buffer noise.
————————-
pi@raspberrypi ~ $ sudo vi /etc/profile
————————-
press G key to go end of file.
press o key once to add one line, type the following.
————————-
con2fbmap 1 1
————————-
press Esc key and press : and w and q and Enter key.
21) For full graphic UI on Raspberry Pi, Now on Raspberyy Pi console,
————————
sudo apt-get install pkg-config xorg-dev
cd xf-video-udlfb
./configure
make
sudo make install
————————
22) On Raspberry Pi console.
————————
cd /usr/share/X11/xorg.conf.d/
sudo vi 99-fbdev.conf
————————
23) press i key once to enter vi editor into edit mode and typing the following.
————————
Section “Device”
  Identifier “myfb”
  Driver “fbdev”
  Option “fbdev” “/dev/fb1”
EndSection
————————
24) press Esc key and press : and w and q and Enter key.
25) On Raspberry Pi console,
————————-
startx
————————-
26) I don’t know why the console screen of AOC monitor goes wrong, but there is a solution. I recommend start as graphical desktop and exit desktop. You can see clear console screen. Sorry, I’m not an expert.
That’s all. Good luck!

Android app for Dream Cheeky Thunder USB missile launcher

Image

 

Google ADT includes the missilelauncher App. source code. I connected it to my Dream Cheeky Thunder USB missile launcher. But it didn’t work. 

I found interesting documents which describes the detail of USB HID requests used in Missile Launcher. http://fivedots.coe.psu.ac.th/~ad/jg/nui04/index.html 

For now I couldn’t download USBTrace for finding out the details of USB HID requests. I have one but evaluation was expired long time ago. Anyway, I installed USBTrace on another computer and found that USB product id, vendor id and internal commands are changed.

You should add the below to device_filter.xml 

<!– vendor and product ID for Dream Cheeky Thunder USB Missle Launcher –>
<usb-device vendor-id=”8483″ product-id=”4112″ />

In MissileLauncherActivity.java, two parts are required to change. 

byte[] message = new byte[2];   // changed 2 from 1
message[0] = 0x02;   // added 
message[1] = (byte)control;  // moved from message[0]

That’s all. 

 

OTG recognition problems of tablets

I bought some Android based tablets from China.  And many of them adopts MediaTek CPU.

I made Android app. which recognizes USB attach event when my USB device is connected to a tablet. In Nexus 5 or Nexus 7 2013 recognizes USB device well. As you know, USB OTG(On The Go) is widely used.

I found that all tablets I bought didn’t recognize USB device. Of course there is no problem with a mouse or USB flash memory. But I can’t use my USB device(USB-to-RF USB stick from SiLabs).

In contrast, the tablets which adopt the Rockchip or Allwinner Boxchip work well with my USB device.

Yesterday, I rent ZTE V967S phone(MediaTek CPU) for testing USB OTG recognition. Fortunately there is no problem with it.

Image

OpenCV development on Raspberry PI

OpenCV development on Raspberry PI

Screenshot is the result of running a sample code of OpenCV Python.
(python chessboard.py)

* Captured using ‘scrot’ program.
* How to install OpenCV : http://denis.doublebuffer.net/lablog/2012/08/10/setting-everything-up-for-opencv-raspberry-pi/