Wednesday, July 13, 2016

Get Current Time from Bed while sleeping (without seeing Watch/Phone) by simple Hand waving

As a part of  Home Automation jobs, one of my use case is:

  • Know the current time in night (in pitch dark room)
    • with following requirements
      • I am still sleeping 
      • I don't want to open my eyes for seeing time on watch/phone
      • My phone or watch are 4 meters from bed, I don't want to go to that place to pickup phone/watch
So thought that let me use latest hot/cheap wifi-chip ESP8266 (NodeMCU version) to do this job.

I used a Passive Infrared Sensor (PIR - ~1$) , ESP8226-NodeMCU-Board ( ~4$) and Android phone (~your capacity)  for this purpose.

  • PIR 
    • Will sense any movement. I had kept this sensor at back of bed. If I wave my hand near PIR sensor, it will sense and give input to ESP8266 Chip
  • ESP8266
    • This will work as WiFi Access Point for Android mobile
    • Runs embedded firmware to sense the PIR reading & debouncing the PIR signal
    • Sends a HTTP call to Android Phone for speaking the time 
  • Android Phone
    • It will connect to WiFi-AP (from above ESP8266 )
    • It works as HTTP-Server for requests from ESP8266
    • It will run a Speaker service for any incoming requests from ESP8266
    • Ensure that works when phone in deep sleep mode

I have finished 3rd version of the code (FW at ESP8266 & Android-App in Smartphone). I will put code and pictures in the weekend.

Thursday, July 7, 2016

9$ Chip Computer is posted from hongkong

Finally my 9$ computer chip-board is dispatched (after whole manufacturing and testing is finished by the chip manufacturer) today from Hongkong. It might arrive after 1 or 2 weeks.

What is this 9$ Computer from

It  has following important specs (I am putting my comments on  w.r.t. Raspberry computer):
  • 9$ System-On-Chip board9Soc Board) that runs most of the modern Linux OS ditsributions -- Raspberry costs 35$
  • It is powered by 1GHz ARM processor
  • 512MB RAM
  • 4GB Flash Space (which can be used as booting medium for OS,applications, etc) -- Raspberry does not have it, we need to use SD-card
  • WiFi  -- Only Raspberry 3 has WiFi
  • Bluetooth 4.0 -- Only Raspberry 3 has  Bluetooth 4.1
  • GUI
    • HDMI port -- can be connected to any modern TV/monitor
    • RCA connector -- can be connected to any old TV
  • Power charging processor  -- Raspberry does not have this vital part for standalone IoT system
    • Which can take power from 5V and supply processor
    • Concurrently charge a Li-Po battery while taking power from 5V power supply
    • If power supply goes off, run the CPU with Li-Po battery without a reboot
  • USB ports 
    • Connect to USB key boards and USB mouse.
    • Also connect to USB flash disk and portable Hard Drives (please keep in mind to not to excess 500 mA when powered from a USB hub)
  • By default comes with Linux-OS (without any OS loading from user part) -- on raspberry we need to load OS
  • Has power switch -- raspberry does not have power switch :(
  • Power from external Li-PO battery
  • Has a camera interface. USB cameras are also can be connected
  • General Purpose IO pins (GPIO) for doing IoT stuff
  • Good development echo system
  • Open sourced (mostly) drivers and Linux kernel

What way it is useful to you

  • Use it to convert your HDMI/RCA/CRT-TV as Smart-TV
  • Run as a computer and connect to your TV monitor
    • Browse Internet without starting Laptop/PC on your TV
  • Use it for Internet of the Things (IoT)
    • Killer point is it has Power supply unit that allows it to be powered from a Li-PO battery
  • Use it for educating your kid on Linux (just like Raspberry does )
  • Use it for reading e-books from TV monitor (though it is not recommended due to eye-strain)
  • Use it for streaming Video from your Laptop/PC to TV
  • Possibilities are limitless -- only your imagination can stop :)

Documentation and Links

So please use this super affordable chip that can do a lot (based on your needs and imagination) for you.

Saturday, July 18, 2015

Finally Made Fly Snap Mobile to connect to ADB shell using USB cable

As part of my IoT/Home-Automation/Home-Monitoring exercises, I was exploring various low cost Android phones that do following:

  • GPS monitoring -- Tracking the Cars/kids/etc
  • Video Camera(s) -- for Video monitoring
  • BLE -- For any IoT
  • Have Android 4.4.2 and above
  • Have minimum 2 ARM cores and 512 MB Ram
I found/bought following Android phones are reasonable VFM for these purposes:
  • BQ S38  ( 50$ ) : 2-core-Cortex-A7, 512MB Ram, 4" IPS, GPS, No BLE , Android 4.4.2
  • Fly Snap ( 50$) : 4-core-SC7731, 512MB Ram, 4", GPS, No BLE , Android 4.4.2
Though I was able to connect BQ S38 via ADB from my Fedora-15, I am not able to connect the Fly-Snap to ADB-server. It seems there are some drivers for Windows at these links:
I could not use them, as I am not using windows and using Fedora-15 :(

I added following lines to /etc/udev/rules.d/52-android.rules:
SUBSYSTEM=="usb", SYSFS{idVendor}=="1782", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="1782" ATTR{idVendor}=="4012"  MODE="0666", OWNER="yyyy"

1782 and 4012 are takes from command 'dmesg'. Then as root, I issued 'udevadm control --reload-rules'.

But I was not able to connect Fly-Snap. So as another step, I added following line to ~/.android/adb_usb.ini

But Then I killed adb-server using 'adb kill-server' and 'adb start-server'. Now I am able to my Fly-Snap device.

Sunday, March 1, 2015

Launchpad can survive on 1000mAh LiPo battery for 1.5 years with Radio Link to RPi board

So after last few days of work on data serialization across Rpi & LaunchPad (MSP430G2553), I integrated the Serialization library that sends couple of 32-bit /16-bit integers from MCU to RPi via NRF24L01+ chip.

Initially MCU was raking around 230uA current . After some tweaking, it came down 130uA .

As final optimization (for this round of testing), I shutdown the NRF24L01+ chip till next time radio-packet-transmission. This step lead to MCU current consumption of 25uA . So in this period (approximate 12 seconds) MCU is in LPM3 sleep-state and radio is in shutdown-state. When MCU wakes-up, it activates NRF chip again & sends radio-packets, during this tx-period, it takes around 400uA for a breif period.

So taking on average current consumption of 50uA (including radio-packet-tx current bump), using battery life calculator for 1000mAh LiPO battery's life is around 14000hours (583 days). Not bad for a starter project :)

I have just documented the initial video for the same at youtube .

I will be submitting the code in github in coming days after stabilization and cleanups.
I will do same test for MSP430F5969 (FRAM board with Super capacitor on it).

Friday, February 27, 2015

Finally able to make Raspberry to talk to MSP430 via NRF24L01+

As a part of my future IoT projects, I was trying to create reusable libraries and utilities for Arduino, MSP430, PIC, Freescale and STM32 processors using Nordic NRF24L01+ wireless transceiver chip. Ultimate goal is to make cheap sensors (that cost less than 7 to10$ including sensors & batteries) that could be deployed in any IoT, HomeAutomation, etc projects. I was planning to use Raspberry (or any cheap Linux board or cheap Android sticks -- future goal)  as my central observer of these cheap nodes.

Here are some  major tasks that were necessary (apart from HW):

  • Circuit diagrams that make connectivity
  • FW for Linux box and MCUs
  • A Data Serialization library for MCUs and Linux box

After lots of trials and tribulations (with limited amount free time after my office/home jobs), I was able to talk Raspberry with following devices (in initial setup scenarios):
  • MSP430 LaunchPad with MSP430G2553
  • MSP430FR5969 LaunchPad
Idea is to make Raspberry as to receive the radio packets from all sensors ( MSP430s, Arduinos, PICs,etc) and this Raspberry connected to network via LAN and WiFi.

As a next step for proper communication along these wide variety of MCUs with different endianness, I need to create small library in C/C++ for packing all types integers (uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t ) and chars.  As I could not get this from web (with whatever search strings I gave), so I created  small library for doing this job. At present this works on Linux (so that Raspberry can understand what wireless nodes are sending), MSP430G2553 and MSP430FR5969. All UT was done for most generic corner cases, I shall be using this for my home IoT framework.

Once I finish more tests and my system, I will publish code at github:
  • Raspberry to MSP430G2553 
  • Raspberry to MSP430FR5969
  • Generic C based Data-Serialization library for Linux/MCUs
I will also publish circuit diagrams for:
  • Raspberry to NRF24L01+
  • MSP430FR5969 to  NRF24L01+
  • MSP430G2553 to  NRF24L01+

Thursday, September 18, 2014

AWM002 Video capturing via webcam

I was planning to use the AWM002 to control access to my home main door. Previously I was using Raspberry for doing same. As Raspberry cost is around 35$ and AWM002 cost is around 11$ (for 10 boards), I wanted to port my application to AWM002 board.

After booting up AWM002 with own OpenWRT kernel, I wanted to use it as video-cam monitor at door entrance. Initially I planned to use mjpg-streamer for OpenWRT. But mjpg-streamer is sending 0-size image on my system.

To isolate issue (whether it is in mjpg-streamer or my usb-webcam), I compiled motion  and deployed on AWM002 board. Now I can see the video perfectly on lan/smartphone via motion-program's-http-URL. I had to tweek following options of motion:
  • stream_localhost off   
    • So that one can access camera from PC/Smartphone
  • output_pictures off
  • output_all off                                                              
  • output_normal off                                                                        
  • output_motion off 
    • All of above options for disabling  the jpeg file generation

Now the AWM002 is running at 18% CPU loading (so enough juice is left for other tasks) with 320x240 resolution. CPU usage drops to 8% when, I make the resolution to 160x128.

I need to bother about CPU load as CPU load has direct effect on battery usage :)

Now steps are to port my python program (on Raspberry) to AWM002.

Monday, September 15, 2014

Able to deploy POCO framework on OpneWRT on AWM002

After successfully installing the OpenWRT linux kernel on AWM002, I configured the OpenWRT build system to have following functionality:

  • GPIO functionality exposed via Linux Kernel GPIO export route.
  • Configured OpenWRT build system to include POCO C++ framework 
    • Create an directory-entry in OpenWRT build root package/libs/poco/
    • Copied all files (actually 2 files)  from  OpenWRT package repo
  • Configured to Linux menuconfg to include to build following libraries
    • librt
    • libstdc++
    • libPoco*
  • My kernel config file