enabling temperature sensor

Connection

Beaglebone DHT11

Connect 3 Pins of DH11 3.3V,  ground and P8_11 headers, for DHT11 sensor initialization by reference of BeagleBone Black’s cape expansion headers information

DH11 specifications

Download Python Library for DHT

Adafruit Python DHT Sensor Library

Python3
$sudo apt-get update 
$sudo apt-get install python3-pip 
$sudo python3 -m pip install --upgrade pip setuptools wheel

Setup Library
$sudo pip3 install Adafruit_DHT

Examine CODES

$sudo python3 ./AdafruitDHT.py 11 P8_11
Temp=21.0* Humidity=39.0%

#!/usr/bin/python
import sys
import Adafruit_DHT

sensor=11
pin="P8_11"

while True:
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
    print('Temp={0:0.1f}*  Humidity={1:0.1f}%'.format(temperature, humidity))

Displaying on LED 7 Segments

I2C Interaction / BBB

Physical connections

GPIO 1: GND —–> 2
GPIO3 :3.3V ——> 4
GPIO19: P9_20 : SCL ——> 18
GPIO20: P9_19: SDA ——> 17

Check Configuration

//To check slave address and bus number
$i2cdetect -r 2
$i2cset 2 0x70 0x70 2
$i2cdump 2 0x70

//To initialise i2c device
$i2cset -y 2 0x70 0x21 // Setup
$i2cset -y 2 0x70 0x81
$i2cset -y 2 0x70 0xe0

Additional Software installation

$sudo apt-get install pip python-dev python-smbus python-imaging git
$sudo pip install Adafruit-LED-Backpack

$git clone https://github.com/adafruit/Adafruit_Python_LED_Backpack.git 
$cd Adafruit_Python_LED_Backpack
$sudo python setup.py install

Compile code

Regardless of program language there are device’ slave address and bus number are pre-defined. It is required to change those values to be synchronized with local environment.

##sevensegment_test.py
//display = SevenSegment.SevenSement() 
display =SevenSegment.SevenSegment(address=0x70, busnum=2)

##example.c
//int i2c_bus = 1
int i2c_bus = 2

Reference

https://andicelabs.com/2013/07/adafruit7segment/
https://cdn-learn.adafruit.com/downloads/pdf/led-backpack-displays-on-raspberry-pi-and-beaglebone-black.pdf
https://emalliab.wordpress.com/2013/07/20/adafruit-8x8-backpack-ht16k33-rpi/

Installing Crossbuild tools

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a Windows 7PC but generates code that runs on Android smartphone is a cross compiler (Wikipedia)

Dependency check on crossbuild-essential-armhf

We should install three pre-requisite packages (actually, two packages)
dpkg-cross, g++arm-linux-gnueabihf and gcc-arm-linux-gnueabihf
$sudo apt-get install dpkg-cross g++arm-linux-gnuabihf

Then, finally crossbuild-essential-armhf can be installed.
$sudo apt-get install crossbuild-essential-armhf

Simple Code Compile/Execution

Hostmachine :Ubuntu 18.04.3 LTS, Architecturer: x86-64

Hostmachine: Debian 9, Architecturer: arm

give BBB an internet access

Tried many things to make BBB connected to internet. There’re few different ways such as by enabling ethernet port or adding USB Wi-Fi dongle. But it won’t work stable when we move BBB to difference environment. Thus, I think sharing host internet is easiest way to give BBB an internet access. To make this we should route all outbound packets to this device from the BBB to the Internet via the Internet access interface.

First thing first, make USB connection between BBB and host machine.
Then check the IP address on USB port.

USB0 has 192.168.7.1 and it is a default gateway for BBB’s usb0 interface.

Host Setting

#Enabling traffic re-routing to Internet Access interface on host machine
#In this case, Internet traffic fro BBB’s USB0 enx4c3fd3c18fa6 will be routed to host’s Wi-Fi interface wlp10
$sudo sysctl net.ipv4.ip_forward=1
$sudo iptables --table nat --append POSTROUTING --out-interface wlp1s0 -j MASQUERADE
$sudo iptables --append FORWARD --in-interface enx4c3fd3c18fa6 -j ACCEPT

BBB Setting

#as a root
[email protected]:/#route add default gw 192.168.7.1
[email protected]:/#echo "nameserver 8.8.8.8" >> /etc/resolv.conf

CISCO ASA

Image retrieved from cisco.com

Open source ? or commercial product? I believe they have pros and cons respectively. PfSense is working perfect as a centralized firewall includes almost everything but need more computing power when it deals with massive network traffic. Cisco ASA series are robust and fast, but expensive. So, maybe mid-range companies or organizations might prefer to use pfSense and big companies seem to use legacy bare-bone firewalls. Anyways it would be better for us to use both side of firewalls and compare its functions together.

Factory reset

Boot up then push esc key few times
rmmon #0>confreg
select no
rmmon #1>confreg 0x41
rmmon #2>boot
ciscoasa>
ciscoasa>enable
blank password
ciscoasa#write erase
ciscoasa#configure terminal
ciscoasa(config)# config-register 0x01
ciscoasa(config)# exit
ciscoasa#show version
ciscoasa#write
ciscoasa#reload
login with blank password
ciscoasa(config)#configure factory-default

Setting up ASDM

#enable password mypassword
#show disk0: (to check asdm bin)
ciscoasa(config)#asdm image disk0:/asdm-xxx.bin
ciscoasa(config)#username sysadmin password mypassword privilege 15 ciscoasa(config)#aaa authentication http console LOCAL
ciscoasa(config)#http server enable 443

We should also install the JRE since ADSM is running on JAVA
Then add JRE path on system environment variables.

Then we can just start making initial configuration for physical ethernet ports. These are might be wan, management, dmz1 or dmz2 depending on purposes, but I would like to say we need to check consoles and GUI together to make sure that configurations are well synchronized.  We can add up Cisco routers or switches to expand or isolate traffics.

connecting BBB /w USB Oscilloscope

We used a quite fancy digital oscilloscope in reverse engineering laboratory. Outside lab, I should find better way to recover my poor learning skills. Honestly, I am not a hardware guy, thus there were always tons of trial errors whenever playing with Beagle Bone. Fortunately, now I found out how to connect USB to TTL serial cable and how to display frequency on the alternative oscilloscope.

Make stable connections with BBB

Fist thing first, we need to connect BBB to PC with regular USB cable.
There is a trick. When BBB is connected to PC, 4 blue LEDs will be blinking simultaneously. As soon as it stops blinking, make USB to TTL cable plugged into serial debug slot. First slot is GND, fourth is TX and firth is RX. Safe option is to push reset button in any unusual cases.

Base terminal application

I have been using the Screen for Raspberry Pi but Minicom is much better for BBB since it can modify some communication options like hardware flow control.

Just make same configuration on Minicom by using minicom -s option then save setup as dfl. Serial device location can be found inside dmesg.

PC based digital oscilloscope

Only thing that I needed to know it how to recap my hands-on exercises. There were bunch of USB digital oscilloscope, but I chose Hantek since it was most cost-effective product in market. If I have enough budget, I would buy the Analog Discovery 2 USB Oscilloscope. Alternatively, I believe Hantek PC Based USB Digital Storage Oscilloscope 6022BE seems to be enough for my purpose. This article was quite helpful: Top 7 PC-based USB oscilloscopes of 2017: for hobbyists, makers, and pros