Arduino Nano +DHT22

#include “DHT.h”
#define DHTPIN 2 // what pin we’re connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE, 6);

void setup() {
Serial.begin(9600);
Serial.println(“DHTxx test!”);

dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
float t = dht.readTemperature();
// Read temperature as Fahrenheit
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}

// Compute heat index
// Must send in temp in Fahrenheit!
float hi = dht.computeHeatIndex(f, h);

Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.print(” *C “);
Serial.print(f);
Serial.print(” *F\t”);
Serial.print(“Heat index: “);
Serial.print(hi);
Serial.println(” *F”);

}

output

DHTxx test!
Humidity: 93.10 % Temperature: 29.90 *C 85.82 *F Heat index: 106.62 *F
Humidity: 93.20 % Temperature: 29.90 *C 85.82 *F Heat index: 106.68 *F
Humidity: 93.30 % Temperature: 29.90 *C 85.82 *F Heat index: 106.74 *F
Humidity: 93.30 % Temperature: 29.90 *C 85.82 *F Heat index: 106.74 *F
Humidity: 93.20 % Temperature: 29.90 *C 85.82 *F Heat index: 106.68 *F

remark ตัว DHT22 ที่ทดสอบ ไม่ค่อยดีนัก

credit:http://arduino-er.blogspot.com/2015/05/arduino-nano-dht11-temperature-humidity.html

nodmcu V3 (Lolin) DHT11 with DeepSleep

การหลับ Deepsleep จะเป็นหน่วย microsecond

#include <ESP8266WiFi.h>
#include “DHT.h”
//deep sleep  wire GPIO16 (D0) to RST Pin
#define DHTPIN D4 // ขา Out ของ Sensor ต่อเข้าขา D4 ของ Esp8266
#define DHTTYPE DHT11 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin();
Serial.begin(9600);
Serial.println(“Humidity and temperature\n\n”);
delay(700);
}

void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print(“Current humidity = “);
Serial.print(h);
Serial.print(“% “);
Serial.print(“temperature = “);
Serial.print(t);
Serial.println(“C “);
//ESP.deepSleep(30e6); // Deep sleep mode for 30 seconds
//ESP.deepSleep(60e6); // Deep sleep mode for 60 seconds
ESP.deepSleep(300e6); // Deep sleep mode for (~5 min) 300 seconds
delay(800);
}

credit:https://roboindia.com/tutorials/DHT11-NodeMCU-arduino

 

nodmcu V3 (Lolin) DHT11 #1

nodmcu-dht11-d4

#include “DHT.h”

#define DHTPIN D4 // ขา Out ของ Sensor ต่อเข้าขา D4 ของ Esp8266
#define DHTTYPE DHT11 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin();
Serial.begin(9600);
Serial.println(“Humidity and temperature\n\n”);
delay(700);
}

void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print(“Current humidity = “);
Serial.print(h);
Serial.print(“% “);
Serial.print(“temperature = “);
Serial.print(t);
Serial.println(“C “);
delay(800);
}

nodmcu-dht11-d4-output

credit:https://roboindia.com/tutorials/DHT11-NodeMCU-arduino

 

nodemcu 0.9 am2305 ds18b20 thingspeak

// www.arduinesp.com
//
// Plot DTH11 data on thingspeak.com using an ESP8266
// April 11 2015
// Author: Jeroen Beemster
// Website: www.arduinesp.com
// ใช้กับ กล่อง วัดอุณหภูมิที่บ้าน
// 20-3-2017 ใช้งานครั้งแรก DHT22
// 19-5-2017 เพิ่ม DS18B20
// 18-12-2017 ซ่อมครั้งที่ 1 เปลี่ยน DHT22 เป็น AM2305
// 26-2-2018 เปลี่ยน accesspoint ใหม่ ตั้งรหัสใหม่ เปลี่ยน thingspeak acc ใหม่
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include “ThingSpeak.h”

// replace with your channel’s thingspeak API key,
unsigned long myChannelNumber = xxxxxx;
const char * myWriteAPIKey = “xxxxxxxxxxxxxx”;

const char* ssid = “SMART_xxx”;
const char* password = “xxxxxxxxxxx”;

#define DHTPIN1 D1 // d0 dht22 ext
// #define DHTPIN2 D2 // d1 dht22 mushroom
DHT dht1(DHTPIN1,DHT22,15);
// DHT dht2(DHTPIN2,DHT22,15);
#define sensorPin D2 // Data wire is plugged into pin D3 on NodeMCU
OneWire oneWire(sensorPin); // Setup the oneWire Sensor
DallasTemperature DS18B20(&oneWire); // Pass reference to Dallas Temperature.
WiFiClient client;

ADC_MODE(ADC_VCC);
// int vcc;
void setup() {
Serial.begin(115200);
delay(10);
dht1.begin();
//dht2.begin();
WiFi.begin(ssid, password);

Serial.println();
Serial.println();
Serial.print(“Connecting to “);
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“”);
Serial.println(“WiFi connected”);
Serial.println(“IP address: “);
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
}

void loop() {

float h1 = dht1.readHumidity();
float t1 = dht1.readTemperature();
float vcc = 0.00f;
vcc = ESP.getVcc()/1024.00f;
// uint32_t vcc = ESP.getVcc()/1000.0;
DS18B20.requestTemperatures();
float t2 = DS18B20.getTempCByIndex(0);
//if (isnan(h1) || isnan(t1) ||isnan(h2) || isnan(t2)) {
if (isnan(h1) || isnan(t1) ) {
Serial.println(“Failed to read from EXT DHT sensor 1 !”);
//return;
t1=0;
h1=0;
}
else if (isnan(t2) ) {
Serial.println(“Failed to read from DS18B20 mushroom sensor 2 !”);
//return;
t2=0;
//h2=0;
}
Serial.print(“Temperature 1: “);
Serial.print(t1);
Serial.print(” C Humidity 1: “);
Serial.print(h1);
Serial.print(” % Voltage : “);
Serial.print(vcc);
Serial.print(” V MushRoom Temperature 2: “);
Serial.print(t2);
Serial.println(” C”);
//Serial.print(” C MushRoom Humidity 2: “);
//Serial.print(h2);
//Serial.println(“% send to Thingspeak”);

ThingSpeak.setField(1,t1);
ThingSpeak.setField(2,h1);
ThingSpeak.setField(3,vcc);
ThingSpeak.setField(4,t2);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
Serial.println(“Waiting”);
delay(20000);
// ThingSpeak will only accept updates every 15 seconds.
// delay 1 minitue delay 1000=1sec

client.stop();

Serial.println(“Wifi Disconnect”);
WiFi.disconnect();
//delay(60000);
delay(100);
//โดย 1,000,000 microseconds = 1 second)
Serial.println(“”);
Serial.println(“Deep Sleep 5 min”);
// deep sleep 1 min
//ESP.deepSleep(60 * 1000000, WAKE_RF_DEFAULT);
//deep sleep 5 min
ESP.deepSleep(360 * 1000000, WAKE_RF_DEFAULT);
//ESP.deepSleep(5*60 * 1000000);
//node.dsleep(60 * 1000000);
delay(500); // wait for deep sleep to happen
}

กู้ไฟล์จาก System Volume Information

Windows Explorer

Tool

folder Options

View

ติ๊ก Show Hidden files กับ Hide protected operting system

System Volume Information

ถ้าเข้าไม่ได้ ติด Access in denied

ไปแก้ Security ให้ permission เป็น Administrators เพราะของเดิมมีแต่ System

อีกตัวคือ แก้ Auditing ให้ Administrators Full Contrtol

อย่าลิม Replace all child object ทั้งคู่

เมื่อเข้าไปแล้ว สามารถเข้าไปดู ใน folder ต่างๆ ว่ามี file ที่ต้องการอยู่หรือไม่ ชื่อจะไม่เหมือนเดิมแต่ ext จะแสดงอยู่

 

ดู product key Windows

1.Produkey โดย nirsoft  http://www.nirsoft.net/utils/product_cd_key_viewer.html

รุ่น ที่สามารถดูได้

  • Microsoft Windows 98/ME
  • Microsoft Windows 2000
  • Microsoft Windows NT
  • Microsoft Windows XP
  • Microsoft Windows Vista
  • Microsoft Windows Server 2003
  • Microsoft Windows 7 (Doesn’t work with Microsoft Volume Licensing)
  • Microsoft Windows 8 (Doesn’t work with Microsoft Volume Licensing)
  • Microsoft Windows 10 (Doesn’t work with all types of licenses)
  • Microsoft Office 2000 (Only ProductID is displayed)
  • Microsoft Office 2003
  • Microsoft Office 2007
  • Microsoft Office 2010
  • Microsoft SQL Server 2000
  • Microsoft SQL Server 2005
  • Microsoft Exchange Server 2000
  • Microsoft Exchange Server 2003
  • Visual Studio
  • Some of the Adobe and Autodesk products

2. WMIC

  • Start ช่อง Search พิมพ์ Command Prompt คลิ๊กขวาเลือก Run As Administrator หรือ ปุ่ม Windows + X แล้วกด A
  • ที่ Command Prompt พิมพ์
  • wmic path softwarelicensingservice get OA3xOriginalProductKey แล้ว Enter

3. Power Shell

  • ที่ PowerShell
  • powershell “(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey”

 

 

Arduino Uno + ESP-01 AT Command #1

arduino-uno-esp-01-at-comm

#include <SoftwareSerial.h>
SoftwareSerial esp8266(6,7); //Rx ==> Pin 6; TX ==> Pin7
#define speed8266 115200
void setup()
{
esp8266.begin (speed8266);
Serial.begin(speed8266);
Serial.println(“ESP8266 Setup test – use AT commands”);
}
void loop()
{
while(esp8266.available())
{
Serial.write(esp8266.read());
}
while(Serial.available())
{
esp8266.write(Serial.read());
}
}

arduino-uno-esp-01-at-command-test

+++++

// cr:http://www.instructables.com/id/Using-ESP-01-and-Arduino-UNO/
// cr:https://create.arduino.cc/projecthub/mjrobot/iot-made-easy-w-uno-esp-01-thingspeak-mit-app-inventor-da6a50
#include <SoftwareSerial.h>
SoftwareSerial esp8266(6,7); //Rx ==> Pin 6; TX ==> Pin7
#define speed8266 115200
#define TIMEOUT 5000 // mS
void setup()
{
esp8266.begin (speed8266);
Serial.begin(speed8266);
// send command connect wifi
SendCommand(“AT+RST”, “Ready”);
delay(5000);
SendCommand(“AT+CWMODE=1″,”OK”);

// sss=ssid ,ppp=password
SendCommand(“AT+CWJAP=\”sss\”,\”ppp\””, “OK”);
Serial.println(“ESP8266 Setup test – use AT commands”);
}
void loop()
{
while(esp8266.available())
{
Serial.write(esp8266.read());
}
while(Serial.available())
{
esp8266.write(Serial.read());
}
}
boolean SendCommand(String cmd, String ack){
esp8266.println(cmd); // Send “AT+” command to module
if (!echoFind(ack)) // timed out waiting for ack string
return true; // ack blank or ack found
}

boolean echoFind(String keyword){
byte current_char = 0;
byte keyword_length = keyword.length();
long deadline = millis() + TIMEOUT;
while(millis() < deadline){
if (esp8266.available()){
char ch = esp8266.read();
Serial.write(ch);
if (ch == keyword[current_char])
if (++current_char == keyword_length){
Serial.println();
return true;
}
}
}
return false; // Timed out
}

credit:https://create.arduino.cc/projecthub/mjrobot/iot-made-easy-w-uno-esp-01-thingspeak-mit-app-inventor-da6a50

ESP-01 AT Firmware AI-Thinker

http://wiki.ai-thinker.com/_media/esp8266/ai-thinker_esp8266_at_firmware_dout_v1.5.4.1-a_20171130.rar

 

Ai-Thinker_ESP8266_DOUT_8Mbit_v1.5.4.1-a_20171130.bin

 

esp-01-at-ai-thinker-firmware

Remember The Name – Fort Minor

You ready?! Let’s go!
Yeah, for those of you that want to know what we’re all about
It’s like this y’all (c’mon!)

[Chorus:]
This is ten percent luck, twenty percent skill
Fifteen percent concentrated power of will
Five percent pleasure, fifty percent pain
And a hundred percent reason to remember the name!

Mike! – He doesn’t need his name up in lights
He just wants to be heard whether it’s the beat or the mic
He feels so unlike everybody else, alone
In spite of the fact that some people still think that they know him
But fuck em, he knows the code
It’s not about the salary
It’s all about reality and making some noise
Making the story – making sure his clique stays up
That means when he puts it down Tak’s picking it up! Let’s go!

Who the hell is he anyway?
He never really talks much
Never concerned with status but still leaving them star struck
Humbled through opportunities given despite the fact
That many misjudge him because he makes a living from writing raps
Put it together himself, now the picture connects
Never asking for someone’s help, or to get some respect
He’s only focused on what he wrote, his will is beyond reach
And now it all unfolds, the skill of an artist

This is twenty percent skill
Eighty percent fear
Be a hundred percent clear cause Ryu is ill
Who would’ve thought he’d be the one to set the west in flames
Then I heard him wreck it with The Crystal Method, “Name Of The Game”
Came back dropped Megadef, took em to church
I like bleach man, why you had the stupidest verse?
This dude is the truth, now everybody’s giving him guest spots
His stock’s through the roof I heard he’s fuckin’ with S. Dot!

[Chorus]

They call him Ryu, he’s sick
And he’s spitting fire
And mike got him out the dryer he’s hot
Found him in Fort Minor with Tak
What a fuckin’ nihilist porcupine
He’s a prick, he’s a cock
The type women want to be with, and rappers hope he get shot
Eight years in the making, patiently waiting to blow
Now the record with Shinoda’s taking over the globe
He’s got a partner in crime, his shit is equally dope
You won’t believe the kind of shit that comes out of this kid’s throat

Tak! – He’s not your everyday on the block
He knows how to work with what he’s got
Making his way to the top
He often gets a comment on his name
People keep asking him was it given at birth
Or does it stand for an acronym?
No he’s living proof, got him rocking the booth
He’ll get you buzzing quicker than a shot of vodka with juice
Him and his crew are known around as one of the best
Dedicated to what they do and give a hundred percent

Forget Mike – Nobody really knows how or why he works so hard
It seems like he’s never got time
Because he writes every note and he writes every line
And I’ve seen him at work when that light goes on in his mind
It’s like a design is written in his head every time
Before he even touches a key or speaks in a rhyme
And those motherfuckers he runs with,
The kids that he signed?
Ridiculous, without even trying,
How did he do it?!

[Chorus – repeat 2x]

[Outro – Mike Shinoda:]
Yeah! Fort Minor
M. Shinoda – Styles of Beyond
Ryu! Takbir! Machine Shop!

credit:https://www.azlyrics.com/lyrics/fortminor/rememberthename.html