Jumat, 29 Mei 2020
Kamis, 28 Mei 2020
Kamis, 21 Mei 2020
lanjutan dari Mobil Molen - modifikasi capit
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
char auth[] = "6shj0yJKzVZnjYgH4H28kq9ww3UKfOai";
char ssid[] = "SIMOR#2019";
char pass[] = "simor123";
Servo servo;
Servo servo1;
int PWMA=5;//Right side
int PWMB=4;//Left side
int DA=0;//Right reverse
int DB=2;//Left reverse
void setup(){
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
servo.attach(14); // 14 means D5 pin of ESP8266
servo.write(0);
servo1.attach(12); // 12 means D6 pin of ESP8266
pinMode(PWMA, OUTPUT);
pinMode(PWMB, OUTPUT);
pinMode(DA, OUTPUT);
pinMode(DB, OUTPUT);
}
void loop(){
Blynk.run();
}
BLYNK_WRITE(V3) {
int molen1 = param.asInt();
if(molen1 == 1 ){
if(!servo1.attached())servo1.attach(12) ;
servo1.write(0);
}else {
servo1.detach();
}
}
BLYNK_WRITE(V2) {
int molen = param.asInt();
if(molen == 1 ){
servo.write(30);
}else if(molen == 0){
servo.write(0);
}
}
BLYNK_WRITE(V0) {
int capit = param.asInt();
if(capit == 1 ){
servo.write(65);
//delay(15);
}else if(capit == 0){
servo.write(0);
}
}
// Handling Joystick data
BLYNK_WRITE(V1){
int x = param[0].asInt();
int y = param[1].asInt();
if(x==-1 && y==-1){ //Backward and Left
digitalWrite(PWMA, LOW);
digitalWrite(DA, LOW);
digitalWrite(PWMB, HIGH);
digitalWrite(DB, HIGH);
}else if(x==-1 && y==0){ //Left Turn
digitalWrite(PWMA, 450);
digitalWrite(DA, HIGH);
digitalWrite(PWMB, 450);
digitalWrite(DB, LOW);
}else if(x==-1 && y==1){ //Forward and Left
digitalWrite(PWMA, LOW);
digitalWrite(DA, LOW);
digitalWrite(PWMB, HIGH);
digitalWrite(DB, LOW);
}else if(x==0 && y==-1){ //Backward
digitalWrite(PWMA, HIGH);
digitalWrite(DA, HIGH);
digitalWrite(PWMB, HIGH);
digitalWrite(DB, HIGH);
}else if(x==0 && y==0){ //Stay
digitalWrite(PWMA, LOW);
digitalWrite(DA, LOW);
digitalWrite(PWMB, LOW);
digitalWrite(DB, LOW);
}else if(x==0 && y==1){ //Forward
digitalWrite(PWMA, HIGH);
digitalWrite(DA, LOW);
digitalWrite(PWMB, HIGH);
digitalWrite(DB, LOW);
}else if(x==1 && y==-1){ //Backward and Right
digitalWrite(PWMA, HIGH);
digitalWrite(DA, HIGH);
digitalWrite(PWMB, LOW);
digitalWrite(DB, LOW);
}else if(x==1 && y==0){ //Right turn
digitalWrite(PWMA, 450);
digitalWrite(DA, LOW);
digitalWrite(PWMB, 450);
digitalWrite(DB, HIGH);
}else if(x==1 && y==1){ //Forward and Right
digitalWrite(PWMA, HIGH);
digitalWrite(DA, LOW);
digitalWrite(PWMB, LOW);
digitalWrite(DB, LOW);
}
}
Minggu, 17 Mei 2020
Senin, 11 Mei 2020
cara merubah baudrate modul SIM900/SIM900A
muncul sharing ini berawal dari sebuah kasus sim900 konek ke server blynk cannot init dan kadang konek kadang diskonek
modul sim900nya konek ke serial1
sediakan power supply minim 12V 3A kemudian d step downkan menjadi 5v
langkah pertama cek dahulu baudratenya menggunakan example dari library tinyGSM yaitu AT_debug
- /
- // Select your modem:
- #define TINY_GSM_MODEM_SIM800
- // #define TINY_GSM_MODEM_SIM900
- // #define TINY_GSM_MODEM_SIM808
- // #define TINY_GSM_MODEM_SIM868
- // #define TINY_GSM_MODEM_UBLOX
- // #define TINY_GSM_MODEM_M95
- // #define TINY_GSM_MODEM_BG96
- // #define TINY_GSM_MODEM_A6
- // #define TINY_GSM_MODEM_A7
- // #define TINY_GSM_MODEM_M590
- // #define TINY_GSM_MODEM_MC60
- // #define TINY_GSM_MODEM_MC60E
- // #define TINY_GSM_MODEM_ESP8266
- // #define TINY_GSM_MODEM_XBEE
- // Set serial for debug console (to the Serial Monitor, speed 115200)
- #define SerialMon Serial
- // Set serial for AT commands (to the module)
- // Use Hardware Serial on Mega, Leonardo, Micro
- #define SerialAT Serial1
- // or Software Serial on Uno, Nano
- //#include <SoftwareSerial.h>
- //SoftwareSerial SerialAT(2, 3); // RX, TX
- #define TINY_GSM_DEBUG SerialMon
- #include <TinyGsmClient.h>
- // Module baud rate
- uint32_t rate = 0; // Set to 0 for Auto-Detect
- void setup() {
- // Set console baud rate
- SerialMon.begin(115200);
- delay(3000);
- }
- void loop() {
- if (!rate) {
- rate = TinyGsmAutoBaud(SerialAT);
- }
- if (!rate) {
- SerialMon.println(F("***********************************************************"));
- SerialMon.println(F(" Module ora ngeRespon "));
- SerialMon.println(F(" Check wiringanmu. wes bener opo durung"));
- SerialMon.println(F(" Check power supplyne ojo sampe kurang arus e. soale arus e butuh guede"));
- SerialMon.println(F("***********************************************************"));
- delay(30000L);
- return;
- }
- SerialAT.begin(rate);
- // Access AT commands from Serial Monitor
- SerialMon.println(F("***********************************************************"));
- SerialMon.println(F(" awakmu wes iso kirim AT commands, "));
- SerialMon.println(F(" ketik AT+CSQ lalu enter, untuk cek signal"));
- SerialMon.println(F(" select \"Both NL & CR\" in Serial Monitor"));
- SerialMon.println(F("***********************************************************"));
- while(true) {
- if (SerialAT.available()) {
- SerialMon.write(SerialAT.read());
- }
- if (SerialMon.available()) {
- SerialAT.write(SerialMon.read());
- }
- delay(0);
- }
- }
cek d serial monitor mana baudrate yang replay
contoh hasil serial monitor yang sim900 tidak merespon:
kemungkinan kabel salah wiring atau power kurang joss
setelah diketahui...
contoh baudratenya 57600
dan mau dirubah ke 9600
maka upload koding selanjutnya
- unsigned long cur_time, old_time;
- void setup() {
- // put your setup code here, to run once:
- delay(2000);
- Serial.begin(115200);
- Serial1.begin(57600);
- delay(1000);
- Serial1.println("AT+IPR=9600");delay(100);
- wRespon(2000);
- Serial1.begin(9600);
- Serial1.println("AT&W");
- wRespon(2000);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- Serial.println("AT");
- Serial1.println("AT+IPR?");
- wRespon(1000);
- delay(1000);
- }
- void wRespon(long waktu){
- cur_time = millis();
- old_time = cur_time;
- while(cur_time - old_time < waktu ){
- cur_time = millis();
- while(Serial1.available()>0){
- Serial.print(Serial1.readString());
- }
- }
- }
sekian tutorial malam ini..
hasil belajar dengan bang jimmi kardo sitepu
Salam
SIMOR
Kamis, 07 Mei 2020
serial mp3 player arduino uno
mengisi waktu liburan dirumah dengan oprek yang gagal waktu lalu..
mencoba membuka laptop dan gelar lapak komponen
komponen yang dibutuhkan:
- arduino uno + kabel data
- serial mp3 player
- speaker harman kardon + jack audio
- kabel jumper
rakit arduino dengan serial mp3 player
ARDUINO - SERIAL MP3 PLAYER
5 TX
6 RX
5V VCC
GND GND
upload sketch dibawah ini:
- #include <SoftwareSerial.h> //library yang digunakan
- #define RX_Mikro 5 //RX Arduino >> TX Module MP3 player
- #define TX_Mikro 6 //TX Arduino >> RX Module MP3 player
- SoftwareSerial mp3module(RX_Mikro, TX_Mikro);
- static int8_t buff_send[8] = {}; //buffer untuk pengiriman perintah
- /************ Command byte **************************/
- #define lagu_berikutnya 0X01
- #define lagu_sebelumnya 0X02
- #define volume_naik 0X04
- #define volume_turun 0X05
- #define reset_mp3 0X0C
- #define mainkan 0X0D
- #define pause_mp3 0X0E
- #define mainkan_folder 0X0F
- #define SEL_DEV 0X09
- #define DEV_TF 0X02
- void setup()
- {
- Serial.begin(9600);
- mp3module.begin(9600);
- delay(500);
- kirimperintah(SEL_DEV, DEV_TF);
- delay(500);
- }
- void sendMP3Command(char c) {
- switch (c) {
- case 'h':
- case '?':
- Serial.println("ini instruksinya!");
- Serial.println(" m = mainkan");
- Serial.println(" b = Pause");
- Serial.println(" n = Lagu selanjutnya");
- Serial.println(" p = Lagu sebelumnya");
- Serial.println(" + = Volume naik");
- Serial.println(" - = Volume turun");
- Serial.println(" 1 = Play folder 1");
- Serial.println(" 2 = Play folder 2");
- Serial.println(" 3 = Play folder 3");
- Serial.println(" 4 = Play folder 4");
- Serial.println(" 5 = Play folder 5");
- Serial.println(" r = Reset_mp3");
- break;
- case 'm':
- Serial.println("Putar Lagu");
- kirimperintah(mainkan, 0X0D);
- break;
- case 'b':
- Serial.println("Lagu Berhenti");
- kirimperintah(pause_mp3, 0X0E);
- break;
- case 'n':
- Serial.println("Lagu berikutnya");
- kirimperintah(lagu_berikutnya, 0X01);
- break;
- case 'p':
- Serial.println("Lagu sebelumnya");
- kirimperintah(lagu_sebelumnya, 0X02);
- break;
- case '+':
- Serial.println("Volume Naik");
- kirimperintah(volume_naik, 0X04);
- break;
- case '-':
- Serial.println("Volume Turun");
- kirimperintah(volume_turun, 0X05);
- break;
- case '1':
- Serial.println("Masuk ke folder 1");
- kirimperintah(mainkan_folder, 0x0101);
- break;
- case '2':
- Serial.println("Masuk ke folder 2");
- kirimperintah(mainkan_folder, 0x0201);
- break;
- case '3':
- Serial.println("Masuk ke folder 3");
- kirimperintah(mainkan_folder, 0x0301);
- break;
- case '4':
- Serial.println("Masuk ke folder 4");
- kirimperintah(mainkan_folder, 0x0401);
- break;
- case '5':
- Serial.println("Masuk ke folder 5");
- kirimperintah(mainkan_folder, 0x0501);
- break;
- case 'r':
- Serial.println("Reset settingan");
- kirimperintah(reset_mp3, 0x00);
- break;
- }
- }
- void kirimperintah(int8_t command, int16_t dat)
- {
- delay(20);
- buff_send[0] = 0x7e;
- buff_send[1] = 0xff;
- buff_send[2] = 0x06;
- buff_send[3] = command;
- buff_send[4] = 0x00; // 0x00 NO, 0x01 feedback
- buff_send[5] = (int8_t)(dat >> 8);
- buff_send[6] = (int8_t)(dat);
- buff_send[7] = 0xef;
- for (uint8_t i =0; i < 8; i++)
- {
- mp3module.write(buff_send[i]) ;
- }
- Serial.println();
- }
- void loop()
- {
- char c = ' ';
- if ( Serial.available() )
- {
- c = Serial.read();
- sendMP3Command(c);
- }
- delay(100);
- }
cek d serial monitor
ketik ? kemudian m buat mainkan
Sabtu, 02 Mei 2020
Training Online DS18B20 berbasis IoT Blynk
peserta harap menyiapkan komponen sebagai berikut :
board esp8266 (nodemcu atau wemos)
sensor ds18b20
kabel jumper
resistor 4k7
software dan library yang harus disiapkan
software arduino IDE
board esp8266
Modscan
zoom bisa via pc atau handphone
library :
all library
sketch:
ds18b20 serial monitor
ds18b20 iot blynk
ds18b20 modbus tcp
materi akan di share sebelum acara dimulai.
posisi peserta mute microphonenya, jika ada yang ditanyakan bisa di unmute atau via chat zoom atau WAG training online.
pendaftaran training silahkan wa ke saya :
wa.me/6281555305255
nama_asal_daftar training online
Langganan:
Postingan (Atom)
Cara membuat datalogger blynk di spreadsheet / googlesheet menggunakan akun versi Free
silahkan video di atas. semoga bermanfaat. jika masih kurang jelas bisa kontak saya
-
#define BLYNK_PRINT Serial #include <TimeLib.h> #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <Wi...
-
Pengertian blynk sudah dijelaskan pada artikel sebelumnya klik apa itu blynk??? Sekarang penjelasan tentang prinsip kerjanya . Blynk ...
-
cara menghitung kebutuhan rectifier untuk suatu supply peralatan. jika rectifier 110VDC dan ingin memasang baterai 12v 100AH. dan beban...