2020/12/31

How to use / navigate this blog

This is a quick summary of how to use / navigate this blog.

Auto Translation by Google Translate

Use the Select Language widget to translate this blog into the language of you choosing (the translation quality may not be good, but I think it's enough to give you some general idea about the post).













2017/08/05

Python - Date Time Comparison

This post is about how to compare system time against a pre-defined time.

1
2
3
4
5
6
7
8
9
import datetime
#print datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
str_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print str_time

if "09:00" in str_time:
   print "True"
else:
   print "False"

References:

Python - How to get current date time and format its output
http://wei48221.blogspot.tw/2017/03/python-how-to-get-current-date-time-and.html

How to determine whether a substring is in a different string
https://stackoverflow.com/questions/7361253/how-to-determine-whether-a-substring-is-in-a-different-string

2017/07/26

IOT Fish Tank

For the past couple of months I've been working on a project that allows me to monitor fish tank and feed the fishes.

The things that I want to do are the followings:

- Feed fishes automatically based on preset schedule or manually by pressing a button on the controller;

- Measure water temperature and water level;

- Measure the ambient light, temperature and humidity;

- Check on the fishes remotely;

- Be able to switch on / off peripherals such as lamp / pump / heater / etc. remotely.

After months of trials and errors and several revision of hardware and software, I am happy to present the result below.

2017/06/26

Working with HC-SR04 Ultrasonic Sensor

This is a brief summary of how to use HC-SR04 ultrasonic sensor.

Schematic


RJ-11 as physical I/O interface

For board with multiple I/O ports and each port has multiple wires, I find it quite convenient to use RJ-11 as the physical I/O interface because it could be plugged / unplugged very quickly and it supports up to 6 wires in one port.


2017/06/22

ESP8266 SPIFFS

This is a summary of my experience testing out the SPIFFS feature for ESP8266.

Below is the source of the Arduino sketch used.
https://github.com/G6EJD/SPIFFS-Examples/blob/master/ESP8266_SPIFFS_Example.ino