Saturday, January 7, 2017

[PYTHON] KerangAjaib Twitter Bot

7 January 2017

Intro

Bot twitter dengan ide kerang ajaib spongebob.

Goal

Mendapatkan jawaban pertanyaan (YA/TIDAK/BISAJADI) saat user memention bot.

Gear

-Server/VPS/PC
-Python 3 (saya menggunakan 3.4.3)
-Twitter Streaming API

Flowchart

Gambar1. Flowchart


Code

- Twitter API Library https://github.com/geduldig/TwitterAPI

Note

- Buat Token di apps.twitter.com
- Program ini never ending loop

Refference

- Twitter API library -> https://github.com/geduldig/TwitterAPI
- Twitter Streaming Api -> https://dev.twitter.com/streaming/overview/request-parameters
- Documentation Tweet User Api -> https://dev.twitter.com/overview/api/tweets

Friday, January 6, 2017

[PROJECT] Bolt 4G Quota Watcher

6 January 2017

Intro

Membuat alat pemantau quota 4G berbasis IoT.

Goal

Menampilkan sisa quota internet pada paket modem bolt realtime berbasis IoT

Gear

-PC dengan PHP server (saya menggunakan wamp)
-ESP8266 (saya menggunakan versi esp-01)
-LCD 16x2 (dengan i2c backpack)
-FTDI loader
-Jumper Wire
-Breadboard/Prototypeboard
-Wifi Network

Flowchart

Gambar 1. Flow Chart


Gambar 2 FTDI + ESP-01 + LCD 16x2


Code

Pada Server
-Menggunakan Library DOM Simple Parser http://simplehtmldom.sourceforge.net/

Pada ESP8266
-Wiring Flash
Gambar3. Wire Map Flash

ESP8266 - FTDI
VCC     - 3.3V
GND     - GND
RX      - TX
TX      - RX
CH_PD   - 3.3V
RST     - PUSH BTN - GND
GPIO0   - GND (FOR FLASH, 3.3V FOR RUNNING)



Gambar4. Wiring ESP-01 to LCD

ESP8266 - i2c 16x2 LCD BACKPACK
GPIO2   - SCL
GPIO0   - SDA
GND     - GND

LCD 16x2 = 5V
ESP8266-01 = 3.3V

-Menggunakan Library LiquidCrystal i2C https://github.com/agnunez/ESP8266-I2C-LCD1602

Note

- ESP-01 menggunakan tegangan 3.3V, dan LCD 16x2 menggunakan 5V
- ESP-01 i2c SDA=GPIO0, SCL=GPIO2
- LiquidCrystal i2C library https://github.com/agnunez/ESP8266-I2C-LCD1602
- buat file cookies.txt pada direktori server
- pada server CURL telah terinstall & enable
- DOM Simple Parser Library http://simplehtmldom.sourceforge.net/
- DOM Simple Parser install pada ./lib/dom/

Refference

- Get Value Function -> http://arduino.stackexchange.com/questions/1013/how-do-i-split-an-incoming-string
- Wiring Flash Program -> https://importhack.wordpress.com/2014/11/22/how-to-use-ep8266-esp-01-as-a-sensor-web-client/
- Wiring LCD 16x2 -> http://domoticx.com/esp8266-wifi-lcd-1602-2004-via-i2c-nodemcu/

Sunday, January 1, 2017

[PHP, PYTHON] Login Page Simple Parser

1 January 2017

Intro::

Simple HTML parser login page, use
- PHP-> Simple DOM HTML Parser + curl. shows nickname.
- Python -> Beautiful Soup

Simple Login + Parsing html

PHP:
PYTHON:

Catatan::

Simple html dom parser manual : http://simplehtmldom.sourceforge.net/manual.htm
Refference : http://stackoverflow.com/questions/3008817/login-to-remote-site-with-php-curl