SBC IoT

Single Board Computer for Internet of Things now are getting more popular since Raspberry Pi.  Now we can see even 64-bit SBC with less than $40 price tag!

Following is the list of SBCs I can think of:

Brand Model CPU Price Website
Raspberry-Pi RPI1 Model A+ BCM2835 $25
Raspberry-Pi RPI1 B+ $35
Raspberry-Pi RPI2 Model B BCM2836 $35
Raspberry-Pi RPI 3 Model B $35
Raspberry-Pi Zero $5
CHIP AllWinner R8 (ARM) $9
Pine64 Cortex-A53 AllWinner A64 $15 – $29
Posted in Uncategorized | Leave a comment

ISC DHCP Server configuration

Subnet <subnet addr> netmask <subnet mask> {

<subnet declarations>

}

The subnet declarations:

Range <first avail addr> <last available addr>

Option <opt name> <opt Value>

option subnet-mask <mask>

option domain-name-servers <comma-Separated dns server addrs>

Default-lease-time <time>

Max-lease-time <time>

Min-lease-time <time>

Posted in Uncategorized | Leave a comment

Arduino 828p Pro Mini

I bought this small board Arduino Mini (the right board, not the left board which is just a power regulator) from eBay from China for less than $2 plus S/H.  The bareboard has SMD version of Atmel AVR 828p, a RESET switch (left), and bunch of I/O ports.  The board seems a clone of what Sparkfun has (see https://www.sparkfun.com/products/11113)

Specifications:

  • 20 Digital input / output ports:TX, RX, D2..D13, A0 .. A5
  • 8 analog inputs ports:A0 ~ A7
  • 1 pairs of TTL level serial transceiver ports RX / TX
  • 6 PWM ports: D3, D5, D6, D9, D10, D11
  • Main Chip: Atmel Atmega328P-AU
  • Support Serial Download
  • Support external power supply 3.8-12V DC
  • Support 12V or less than 12V battery power supply
  • 16MHz clock frequency
  • Size: 33.8mm x 18mm
  • Supports auto-reset
  • Max 150mA output
  • Over current protected
  • Weighs less than 2 grams

When supplying unregulated power to the board, we should connect to the “RAW” pin and not VCC.
I/O pins are labeled “D0”, “D1”, … “D13” for digital I/Os, and “A0” to “A7” for analog inputs.  There are two TRO and RXI pins.

Label on Board Function(s)
A0 ADC0
A1 ADC1
A2 ADC2
A3 ADC3
A4 ADC4/SDA
A5 ADC5/SCL
A6 ADC6
A7 ADC7
RXI D0/RXD
TXO D1/TXD
D2 D2/INT0
D3 D3/INT1
D4 D4/T0
D5 D5
D6 D6/OC0B
D7 D7/IN1
D7 D8/ICP1
D7 D9/PCINT1
D7 D10/PCINT2
D7 D11/PCINT3
D7 D12/MISO
D7 D13/SCK/LED
Posted in arduino, microcontroller | Leave a comment

Raspberry Pi vs. Next-Big-Thing’s CHIP SoC Computer


Feature
RPI 1 Model A
RPI 1 Model B
RPI 1 Model A+
RPI 1 Model B+
RPI 2ModelB
NBT CHIP

SoC
BRCM 2835
BRCM 2835
BRCM 2835
BRCM 2835

AllWinner’s R8
Standard SoC Speed (MHz)
700
700
700
700
900
1000

RAM (MB)
256
512
256
512

512
Ethernet (Mbps)
N/A
100
100
100
1000
N/A

HDMI output
N/A
Yes
Yes
Yes
Yes
With extra module

Composite Video out
Yes
Yes
via 3.5 mm jack
via 3.5 mm jack
via 3.5 mm jack Yes

Number of USB2.0
2
2
1
4
4
1

CPU Cores 1 1 1 1 4 1
Storage SD Card SD Card micro SD micro SD MicroSD Built-in Flash
Internal Storage Capacity N/A N/A N/A N/A N/A 4 MB
Camera Interface (CSI)
yes yes yes yes yes
Display Interface (DSI)
yes yes yes yes yes
Video/Graphic Coprocessor VideoCore IV VideoCore IV VideoCore IV VideoCore IV VideoCore IV PowerVR SGX544
Architecture ARM11v6 ARM11v6 ARM11v6 ARM11v6 ARMv7 ARMv7
GPIO Pins 26 40 40 40 40
Posted in Cheap Linux On Stick, http://schemas.google.com/blogger/2008/kind#post, Linux, Linux embedded, SoC | Leave a comment

wxWidgets 3.0

To add the repository, first import the key:
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
 

Then add the source:


sudo tee /etc/apt/sources.list.d/wxwidgets.list
deb http://repos.codelite.org/wx3.0.2/ubuntu/ $(lsb_release -sc) universe
sudo apt-get update

Install wxWidgets modules:


sudo apt-get install libwxbase3.0-0-unofficial libwxbase3.0-dbg libwxbase3.0-dev libwxgtk3.0-0-unofficial libwxgtk3.0-dbg wx3.0-doc wx3.0-examples

Create soft-link:

sudo ln -s /usr/include/wx-3.0-unofficial/wx /usr/include/wx 

To compile a single file, create a script named wxcompile and edit it with the content as below (assume with have subdirectory obj/Debug and bin/Debug:


#!/bin/bash

if [ -z "${1}" ]
then
echo "$0 "
exit 1
fi

FILE=`basename $1`
CPPF=$FILE
OBJF=`basename -s .cpp $CPPF`
OBJF=${OBJF}.o
g++ -g -c -Wall -DWX_PRECOMP -Winvalid-pch `wx-config --cppflags` -o obj/Debug/${OBJF} ${CPPF}

To link, create a script file name ‘wxlink’ and its content as below:


#!/bin/bash

if [ -z "${1}" ]
then
echo "$0 "
exit 1
fi

FOUT=$1
OBJF=obj/Debug/*.o

g++ -v obj/Debug/*.o `wx-config --libs` -o obj/Debug/$FOUT

For a bigger project which requires more complicated and conditional compilation, use Makefile.

Posted in Uncategorized | Leave a comment

OpenFrameworks: Another cool Multi-platform Framework for Graphics

Steps to download and build OpenFrameWorks:
  • Execute the scripts in the folder as root:

sudo ./install_dependencies.sh

sudo ./install_codecs.sh

Go to ./scripts/linux and execute:

./compileOF.sh
./compilePG.sh

To generate projects (Makefile etc.)  for all the examples, goto OF root, then type:

projectGenerator -v -r examples/

Posted in Uncategorized | 1 Comment

Watching Nabawi-TV via VLC on Raspberry Pi

A new Indonesian da’wah TV has provided a streaming.

To watch, install vlc.  Once installed, open the VLC, click “Media”, and then “Open Network Stream”.  Enter:

rtsp://wowza60.indostreamserver.com:1935/nabawitv/live

Posted in Uncategorized | Leave a comment

Script to simulate multiple DHCP clients

#!/bin/sh
#simulate 255 IPhones requesting DHCP
 
 
# Apple OUI = D8:96:95
BASE="d8:96:95:08:96"
FROM=$1
shift
TO=$2
 
if [ -e $FROM ]; then FROM=1; fi
if [ -e $TO ]; then TO=1; fi
 
for i in `seq $FROM $TO`
do
    LSB=`echo "obase=16; $i" | bc`
    MAC="$BASE:$LSB"
    HNAME="`uname -n`-fakehost-$i"
    #CMD="$HOME/bin/dhtest -m $MAC -V -i eth1 -h '$HNAME'"
    CMD="$HOME/bin/dhtest -m $MAC -i eth1 -h '$HNAME'"
    echo $CMD
    $CMD
    sleep 1
done


Another way, the program dhtest (source code) can be download from  https://github.com/saravana815/dhtest.  

For example:

 
git clone https://github.com/saravana815/dhtest
cd dhtest
make
Posted in Uncategorized | Leave a comment

Daily backup of local git changes

While working on a ticket and not ready to commit, it’s a good idea to backup all of our changes to an archive file.

The following script does all that and executed daily by cronjob automatically.

  1. create a file, say “backup” in /etc/cron.daily
  2. Type the following (change ‘‘ to your own login name and to the git directory where source codes are located):
backing up changed files to tarball
#!/bin/sh
pushd
LIST=`git status --porcelain | sed -n -e '/^ [D|M]/p' | sed -e 's/^ [D|M] //'`
backupname=`git branch | sed -n -e "/^* /p" | sed  -e 's/** //'`
backupname=$backupname-`date "+%s"`.backup.tar.bz2
dest=''
if [ ! -d "$dest" ]
then
    mkdir -p $dest
fi
tar jcvf $dest/$backupname $LIST > /dev/null

Make the file executable:

chmod +x /etc/cron.daily/backup
Posted in Uncategorized | Leave a comment

Block Access during certain period using EBTABLES

Say, we want to block any packets coming from a device with mac address 00:01:02:03:04:05 (in other words, our router/switch should just silently drop any packets coming from this MAC address) during period of time 00:00 (00:00 AM) to 6:00 AM, do:

#ebtables -A INPUT -s 00:01:02:03:04:05  –timestart 0:0 –timestop 06:00 -j DROP

If we just want to drop IPv4 packets for the above:
#ebtables -A INPUT -p IPv4 -s 00:01:02:03:04:05  –timestart 0:0 –timestop 06:00 -j DROP


So, parameters for ebtables are actually similar (yet subset) of iptables (netfilter).
Posted in Uncategorized | Leave a comment