@Chris-Stratton slip of the pen I meant microcontrollers....
Posts made by Oene Bakker
-
RE: GPS tracker
@Ken-Conrad I tested it at home and it really was 4.5 hours active. So perhaps these Ultrafire batteries are of better quality(?)
-
RE: GPS tracker
@Chris-Stratton no particularly reason. Just because it can. Also tried some other micro
processorcontrollers (raspberry pi, eps12 and arduino). Was just curious it would work on the omega 2. Using the battery pack with 4x 18650 (6000 mA) batteries gives a lifespan of approximately 4.5 hours. -
RE: DHT11/22 checkHumidity syntax error
@Prakhar-Birla no sorry. I stopped trying.
-
GPS tracker
In this project I'm going to connect a GPS module and use it as a GPS tracker.
Hardware
For this project I'm using:
-
Onion Omega 2 plus
-
U-BLOX NEO-6M GPS module
-
PL2303HXD Serial to USB cable
-
Battery case with USB in and out (5V/2.1A max)
-
4x 18650 (3.7V/6000mA) batteries
-
Breadboard and some cables
The GPS module can be used on 3.3V or 5V. Connected to the battery pack it can be used for approximately 4.5 hours (not bad I think).
Connect the GPS module as follow to the PL2303HXD:
GPSÂ -Â PL2303HXD
VCCÂ - Â 5V
GNDÂ -Â GND
TXÂ Â Â Â -Â RXD (white)
RXÂ Â Â Â -Â TXD (green)Connect PL2302HXD to Onion Omega 2+ USB
Installation
Step 1
Use the latest firmwareoupgrade
Device Firmware Version: 0.1.10 b160
Checking latest version online...
Repo Firmware Version: 0.1.10 b160
Comparing version numbers
Device firmware is up to date!Step 2
Update packagesopkg update
Step 3
I prefer nano as an editor, but there is no default installationopkg install nano
Step 4
I want to expand the filesystem so I can write large tracker files. So I need the following utility:opkg install e2fsprogs
Step 5
To use the USB to serial I need the following installations:opkg install coreutils-stty kmod-usb-serial-pl2303
Step 6
Add a SD card (I use a 2GB SD card)Look for SD card:
dmesg | grep mmc
[ 4.786320] mmc0: new high speed SD card at address 1234
[ 4.803969] mmcblk0: mmc0:1234 SA02G 1.85 GiB
[ 4.896881] mmcblk0: p1
...Format and mount SD card
root@Omega-5101:~# mkfs.ext4 /dev/mmcblk0
root@Omega-5101:~# mkdir /mnt/mmcblk0
root@Omega-5101:~# mount /dev/mmcblk0 /mnt/mmcblk0/Edit fstab
root@Omega-5101:~# /sbin/block detect > /etc/config/fstab
root@Omega-5101:~# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.@mount[0]=mount
fstab.@mount[0].target='/mnt/mmcblk0'
fstab.@mount[0].uuid='5417dc6b-0135-4f71-8ea0-f81d0666989c'
fstab.@mount[0].enabled='0'Enable mount
root@Omega-5101:~# uci set fstab.@mount[0].enabled='1'
root@Omega-5101:~# uci commit fstab
root@Omega-5101:~# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.@mount[0]=mount
fstab.@mount[0].target='/mnt/mmcblk0'
fstab.@mount[0].uuid='5417dc6b-0135-4f71-8ea0-f81d0666989c'
fstab.@mount[0].enabled='1'Make it permanent
root@Omega-5101:~# /etc/init.d/fstab enable
root@Omega-5101:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 5.5M 5.5M 0 100% /rom
tmpfs 61.4M 216.0K 61.2M 0% /tmp
/dev/mtdblock6 25.1M 1.2M 23.9M 5% /overlay
overlayfs:/overlay 25.1M 1.2M 23.9M 5% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0 1.8G 5.5M 1.7G 0% /mnt/mmcblk0Step 7
Expand filesystem (overlay)root@Omega-5101:~# mount /dev/mmcblk0 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
Edit fstab
root@Omega-5101:~# nano /etc/config/fstab
config 'global'
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'config 'mount'
option target '/mnt/mmcblk0'
option uuid '5417dc6b-0135-4f71-8ea0-f81d0666989c'
option enabled '0'Change to:
config 'global'
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'config 'mount'
option target '/overlay'
option uuid '5417dc6b-0135-4f71-8ea0-f81d0666989c'
option enabled '1'Ctr+X --> Y
Reboot
root@Omega-5101:~# reboot
root@Omega-5101:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 5.5M 5.5M 0 100% /rom
tmpfs 61.4M 104.0K 61.3M 0% /tmp
/dev/mmcblk0 1.8G 6.7M 1.7G 0% /overlay
overlayfs:/overlay 1.8G 6.7M 1.7G 0% /
tmpfs 512.0K 0 512.0K 0% /devStep 8
Set timezone.
I'm living in the Netherlands so I choose the timezone for Amsterdam.
The timezones list is on: TimezonesWe also need the corresponding NTP-servers. I'm using the dutch (nl) pool servers.
The pool servers list is on: NTP poolChange timezone en ntp-servers to your choices
root@Omega-5101:/# cd /etc/config
root@Omega-5101:/etc/config# nano systemconfig system
#option timezone 'GMT0'
option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
option ttylogin '0'
option log_size '64'
option urandom_seed '0'
option cronloglevel '8'
option hostname 'Omega-5101'
#
config timeserver 'ntp'
option enabled '1'
option enable_server '0'
list server '0.nl.pool.ntp.org'
list server '1.nl.pool.ntp.org'
list server '2.nl.pool.ntp.org'
list server '3.nl.pool.ntp.org'Ctrl+X + Y
root@Omega-5101:/etc/config# reboot
Check date / time
root@Omega-5101:~# date
Fri Mar 10 17:15:02 CET 2017Step 9
Install Pythonroot@Omega-5101:~# opkg update
root@Omega-5101:~# opkg install python
root@Omega-5101:~# opkg install python-pyserialStep 10
Check if GPS is connectedroot@Omega-5101:~# dmesg | grep pl2303
[ 10.664492] usbcore: registered new interface driver pl2303
[ 10.670369] usbserial: USB Serial support registered for pl2303
[ 10.676466] pl2303 2-1:1.0: pl2303 converter detected
[ 10.703003] usb 2-1: pl2303 converter now attached to ttyUSB0Getting data from GPS
root@Omega-5101:~/gps# stty -F /dev/ttyUSB0 ispeed 9600 && cat </dev/ttyUSB0
$GPRMC,154105.00,A,5315.64610,N,00601.92077,E,0.092,,030317,,,A*72
$GPGGA,154105.00,5315.64610,N,00601.92077,E,1,08,1.00,-7.0,M,45.6,M,,*77
...
Ctrl+ZStep 10
Make tracker source
root@Omega-5101:~# cd ~
root@Omega-5101:~# mkdir gps
root@Omega-5101:~# cd gps
root@Omega-5101:~# nano tracker.pySource:
tracker.pyStep 11
Test the trackerroot@Omega-5101:~/gps# python tracker.py
Start reading: /dev/ttyUSB0
[1] Wait for GPS data 2017-03-10 17:22:37
[1] GPS tracker alive at 2017-03-10 17:22:39
[2] GPS tracker alive at 2017-03-10 17:22:44
[3] GPS tracker alive at 2017-03-10 17:22:50
[4] GPS tracker alive at 2017-03-10 17:22:55
...Ctrl+Z of Ctrl+C
Show ublox file
root@Omega-5101:~/gps# nano t20170310172237.ubx
$GPGLL,5315.64852,N,00601.92650,E,162238.00,A,A*65
$GPGGA,162239.00,5315.64882,N,00601.92671,E,1,06,2.13,1.6,M,45.6,M,,*59
...Step 12
So I connected the GPS tracker to the battery pack and went for a bike ride and recorded the result.
The ublox fileformat can be used with u-centerThis is the result:
-
-
RE: DHT11/22 checkHumidity syntax error
@WereCatf
No but when I use a 10K pull up I get the same resultsroot@Omega-5101:~/checkHumidity/bin# ./checkHumidity 20 DHT11
-255.000000
-255.000000Also tried lower values 4.7K and 1K but that didn't work also
-
RE: DHT11/22 checkHumidity syntax error
@WereCatf
Yes, sorry was a bit too quickSo went back to the old firmware
root@Omega-5101:~/checkHumidity/bin# oupgrade -c
Device Firmware Version: 0.1.6 b137
Checking latest version online...
Repo Firmware Version: 0.1.9 b149
Comparing version numbers
New firmware version available, need to upgrade device firmwareNow I'm getting:
root@Omega-5101:~/checkHumidity/bin# ./checkHumidity 20 DHT11
-255.000000
-255.000000Checked the wiring and tried different GPIO's all with the same result
-
RE: DHT11/22 checkHumidity syntax error
@WereCatf
I downloaden the request package : https://dl.dropboxusercontent.com/u/11811685/checkHumidity.tar.gzUnpacked it:
tar -zxvf checkHumidity.tar.gzDid the chmod:
chmod -R 755 /root/checkHumidity/bin/checkHumidityI checked the firmware
root@Omega-5101:~# oupgradeDevice Firmware Version: 0.1.9 b149
Checking latest version online...
Repo Firmware Version: 0.1.9 b149
Comparing version numbers
Device firmware is up to date!But I'm getting a segmation fault:
root@Omega-5101:~/checkHumidity/bin# ./checkHumidity 20 DHT11
Segmentation faultI tried different GPIO pin, all gave the same result
-
DHT11/22 checkHumidity syntax error
Following the tutorial I get a syntax eror when executing checkHumidity:
root@Omega-5101:~/checkHumidity/bin# ./checkHumidity 1 DHT11
./checkHumidity: line 1: syntax error: unexpected "(" (expecting ")")
root@Omega-5101:~/checkHumidity/bin#