orma, somente com o bluetooth. Ja possuo uma pagina em php rodando e funcinando desligando lampadas e abrindo portao, mas esse assunto no app inventor ja faz 2 semana que estou nessa luta e nao encontro respostas. Desde ja agradeço…
do arduino a leitura do sensor de corrente mas mantive as 2 textbox e o app rodou normal mas com a leitura do sensor de corrente no texbox da luminosidade
Quando inclui mais uma textbox para ler a corrente ai formou a bagunça, as leituras variam nas 3 textbox o app fica lento e travando
Nao sei onde esta o problema, alguem ja passou por isso? tem pelo menos alguma ideia de alguma solução?
Criei um app com 1 textbox pra pra ler a corrente e ele nao mostrou nada, mantive o mesmo app e troquei no arduino o codigo da leitura da corrente pela leitura da temperatura e o app mostrou a temperatura, se coloco a leitura dos 2 sensores no arduino o app mostra na mesma textbox os valores.. mas da corrente sozinha nao mostra
diagrama do app inventor
codigo arduino
valAnalog = analogRead(PinAnalogA2); temp = (valAnalog * 5.0*100) /1024; if(temp > maxi) { maxi = temp; } // regista temperatura maxima if(temp < mini) { mini = temp; } // regista temperatura minima Serial.print("Atual= " ); Serial.print(temp); Serial.print(" \nMinima = " ); Serial.print(mini); Serial.print(" \nMaxima= " ); Serial.print(maxi); Serial.println(""); for(int i=100; i>0; i--){ sensorValue_aux = (analogRead(sensorPin) -511); // le o sensor na pino analogico A0 e ajusta o valor lido ja que a saída do sensor é (1023)vcc/2 para corrente =0 sensorValue += pow(sensorValue_aux,2); // somam os quadrados das leituras. } sensorValue = (sqrt(sensorValue/ 100)) * voltsporUnidade; // finaliza o calculo da méida quadratica e ajusta o valor lido para volts currentValue = (sensorValue/0.185); // calcula a corrente considerando a sensibilidade do sernsor (185 mV por amper) //mostra o resultado no terminal Serial.print(currentValue,3); Serial.print(" A \n" ); delay(1000);
na serial com os 3 sensores
…
uiser consultar clico em um app no celular e ele me informa qual a tensão e a corrente de cada bateria ou todas juntas. (ainda não sei).
já tenho ideias do projeto com o Arduíno due e um shield Ethernet , tbm usarei o app inventor 2 para fazer o app. a dificuldade maior será com o projeto eletrônico. to sm ideias e gostaria de avançar nesse projeto e conto com a colaboração de todos.
banco de bateria : 4 baterias automotivas de 12 volts 60 amperes cada ligadas em serie.
internet com ip fixo no local.
melhor usar sensor pronto ou fazer um apartir de transformador???
minha ideia e um voltímetro(ou algo parecido) ligado ao arduino mandando essa leitura para o celular android ?????? não necessito de leituras no local (visor lcd).
desde ja agradeço atenção…
al de temperatura para manter a padronagem dos blends de cafe.
Esse controle é feito de 2 formas:
1 º é ligando e desligando um queimador monobloco. http://holamaq.com.br/holamaq/app/webroot/files/manuais/mb350_500.pdf
2º através de um motor que suga o ar de dentro do cilindro de torra.
O queimador é facilmente controlado por reles.
Eu to empacado justamente no controle do sugador de ar. atualmente o controle é feito através de um registro mecânico. …
ara as bobinas do rele, pois estou utilizando o modulo rele de 4 canais. Não entendi essa pergunta em relação a carga.
3) Sim, tanto no modo push quanto switch. E funcionou perfeitamente até mesmo 2 ele funciona perfeitamente.
No momento não estou em cara, assim que eu chegar, vou tentar mudar todos os componentes e ver se algum que esta dando o defeito.…
------------ Arduino 3.3V --------------------- 3.3V SDA ----------------------- SDA 20 SCL ----------------------- SCL 21 INT2 ---------------------- D3 INT1 ---------------------- D2 GND ---------------------- GND
No entanto, quando Abro a interface Serial vejo:
Could not connect to MMA8452Q: 0xFF
Alguma idéia do que pode estar errado?
Estou usando o código:
#include <Wire.h>
#define SA0 1#if SA0 #define MMA8452_ADDRESS 0x1D #else #define MMA8452_ADDRESS 0x1C#endif
/* Set the scale below either 2, 4 or 8*/const byte SCALE = 2; // Sets full-scale range to +/-2, 4, or 8g. Used to calc real g values./* Set the output data rate below. Value should be between 0 and 7*/const byte dataRate = 0; // 0=800Hz, 1=400, 2=200, 3=100, 4=50, 5=12.5, 6=6.25, 7=1.56
/* Pin definitions */int int1Pin = 2; // These can be changed, 2 and 3 are the Arduinos ext int pinsint int2Pin = 3;
int accelCount[3]; // Stores the 12-bit signed valuefloat accelG[3]; // Stores the real accel value in g's
void setup(){ Wire.begin(); // join i2c bus (address optional for master)
byte c; Serial.begin(9600);
/* Set up the interrupt pins, they're set as active high, push-pull */ pinMode(int1Pin, INPUT); digitalWrite(int1Pin, LOW); pinMode(int2Pin, INPUT); digitalWrite(int2Pin, LOW); /* Read the WHO_AM_I register, this is a good test of communication */ c = readRegister(0x0D); // Read WHO_AM_I register if (c == 0x2A) // WHO_AM_I should always be 0x2A { initMMA8452(SCALE, dataRate); // init the accelerometer if communication is OK Serial.println("MMA8452Q is online..."); } else { Serial.print("Could not connect to MMA8452Q: 0x"); Serial.println(c, HEX); while (1) // Loop forever if communication doesn't happen ; }}
byte val = 0;
void loop(){ static byte source; /* If int1 goes high, all data registers have new data */ if (digitalRead(int1Pin)==1) // Interrupt pin, should probably attach to interrupt function { readAccelData(accelCount); // Read the x/y/z adc values /* Below we'll print out the ADC values for acceleration for (int i=0; i<3; i++) { Serial.print(accelCount[i]); Serial.print("\t\t"); } Serial.println();*/ /* Now we'll calculate the accleration value into actual g's */ for (int i=0; i<3; i++) accelG[i] = (float) accelCount[i]/((1<<12)/(2*SCALE)); // get actual g value, this depends on scale being set /* print out values */ for (int i=0; i<3; i++) { Serial.print(accelG[i], 4); // Print g values Serial.print("\t\t"); // tabs in between axes } Serial.println(); }
/* If int2 goes high, either p/l has changed or there's been a single/double tap */ if (digitalRead(int2Pin)==1) { source = readRegister(0x0C); // Read the interrupt source reg. if ((source & 0x10)==0x10) // If the p/l bit is set, go check those registers portraitLandscapeHandler(); else if ((source & 0x08)==0x08) // Otherwise, if tap register is set go check that tapHandler(); }
delay(100);}
void readAccelData(int * destination){ byte rawData[6]; // x/y/z accel register data stored here
readRegisters(0x01, 6, &rawData[0]); // Read the six raw data registers into data array /* loop to calculate 12-bit ADC and g value for each axis */ for (int i=0; i<6; i+=2) { destination[i/2] = ((rawData[i] << 8) | rawData[i+1]) >> 4; // Turn the MSB and LSB into a 12-bit value if (rawData[i] > 0x7F) { // If the number is negative, we have to make it so manually (no 12-bit data type) destination[i/2] = ~destination[i/2] + 1; destination[i/2] *= -1; // Transform into negative 2's complement # } }}
/* This function will read the status of the tap source register. And print if there's been a single or double tap, and on what axis. */void tapHandler(){ byte source = readRegister(0x22); // Reads the PULSE_SRC register if ((source & 0x10)==0x10) // If AxX bit is set { if ((source & 0x08)==0x08) // If DPE (double puls) bit is set Serial.print(" Double Tap (2) on X"); // tabbing here for visibility else Serial.print("Single (1) tap on X"); if ((source & 0x01)==0x01) // If PoIX is set Serial.println(" +"); else Serial.println(" -"); } if ((source & 0x20)==0x20) // If AxY bit is set { if ((source & 0x08)==0x08) // If DPE (double puls) bit is set Serial.print(" Double Tap (2) on Y"); else Serial.print("Single (1) tap on Y"); if ((source & 0x02)==0x02) // If PoIY is set Serial.println(" +"); else Serial.println(" -"); } if ((source & 0x40)==0x40) // If AxZ bit is set { if ((source & 0x08)==0x08) // If DPE (double puls) bit is set Serial.print(" Double Tap (2) on Z"); else Serial.print("Single (1) tap on Z"); if ((source & 0x04)==0x04) // If PoIZ is set Serial.println(" +"); else Serial.println(" -"); }}
/* This function will read the p/l source register and print what direction the sensor is now facing */void portraitLandscapeHandler(){ byte pl = readRegister(0x10); // Reads the PL_STATUS register switch((pl&0x06)>>1) // Check on the LAPO[1:0] bits { case 0: Serial.print("Portrait up, "); break; case 1: Serial.print("Portrait Down, "); break; case 2: Serial.print("Landscape Right, "); break; case 3: Serial.print("Landscape Left, "); break; } if (pl&0x01) // Check the BAFRO bit Serial.print("Back"); else Serial.print("Front"); if (pl&0x40) // Check the LO bit Serial.print(", Z-tilt!"); Serial.println();}
/* Initialize the MMA8452 registers See the many application notes for more info on setting all of these registers: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MMA8452Q Feel free to modify any values, these are settings that work well for me.*/void initMMA8452(byte fsr, byte dataRate){ MMA8452Standby(); // Must be in standby to change registers /* Set up the full scale range to 2, 4, or 8g. */ if ((fsr==2)||(fsr==4)||(fsr==8)) writeRegister(0x0E, fsr >> 2); else writeRegister(0x0E, 0); /* Setup the 3 data rate bits, from 0 to 7 */ writeRegister(0x2A, readRegister(0x2A) & ~(0x38)); if (dataRate <= 7) writeRegister(0x2A, readRegister(0x2A) | (dataRate << 3)); /* Set up portrait/landscap registers - 4 steps: 1. Enable P/L 2. Set the back/front angle trigger points (z-lock) 3. Set the threshold/hysteresis angle 4. Set the debouce rate // For more info check out this app note: http://cache.freescale.com/files/sensors/doc/app_note/AN4068.pdf */ writeRegister(0x11, 0x40); // 1. Enable P/L writeRegister(0x13, 0x44); // 2. 29deg z-lock (don't think this register is actually writable) writeRegister(0x14, 0x84); // 3. 45deg thresh, 14deg hyst (don't think this register is writable either) writeRegister(0x12, 0x50); // 4. debounce counter at 100ms (at 800 hz) /* Set up single and double tap - 5 steps: 1. Set up single and/or double tap detection on each axis individually. 2. Set the threshold - minimum required acceleration to cause a tap. 3. Set the time limit - the maximum time that a tap can be above the threshold 4. Set the pulse latency - the minimum required time between one pulse and the next 5. Set the second pulse window - maximum allowed time between end of latency and start of second pulse for more info check out this app note: http://cache.freescale.com/files/sensors/doc/app_note/AN4072.pdf */ writeRegister(0x21, 0x7F); // 1. enable single/double taps on all axes // writeRegister(0x21, 0x55); // 1. single taps only on all axes // writeRegister(0x21, 0x6A); // 1. double taps only on all axes writeRegister(0x23, 0x20); // 2. x thresh at 2g, multiply the value by 0.0625g/LSB to get the threshold writeRegister(0x24, 0x20); // 2. y thresh at 2g, multiply the value by 0.0625g/LSB to get the threshold writeRegister(0x25, 0x08); // 2. z thresh at .5g, multiply the value by 0.0625g/LSB to get the threshold writeRegister(0x26, 0x30); // 3. 30ms time limit at 800Hz odr, this is very dependent on data rate, see the app note writeRegister(0x27, 0xA0); // 4. 200ms (at 800Hz odr) between taps min, this also depends on the data rate writeRegister(0x28, 0xFF); // 5. 318ms (max value) between taps max /* Set up interrupt 1 and 2 */ writeRegister(0x2C, 0x02); // Active high, push-pull interrupts writeRegister(0x2D, 0x19); // DRDY, P/L and tap ints enabled writeRegister(0x2E, 0x01); // DRDY on INT1, P/L and taps on INT2 MMA8452Active(); // Set to active to start reading}
/* Sets the MMA8452 to standby mode. It must be in standby to change most register settings */void MMA8452Standby(){ byte c = readRegister(0x2A); writeRegister(0x2A, c & ~(0x01));}
/* Sets the MMA8452 to active mode. Needs to be in this mode to output data */void MMA8452Active(){ byte c = readRegister(0x2A); writeRegister(0x2A, c | 0x01);}
/* Read i registers sequentially, starting at address into the dest byte arra */void readRegisters(byte address, int i, byte * dest){ Wire.beginTransmission(MMA8452_ADDRESS); // Open communications with device Wire.write(address); // write register address Wire.endTransmission(false); // don't send a stop Wire.requestFrom(MMA8452_ADDRESS, i); int j = 0; while(Wire.available()) // slave may send less than requested { dest[j] = Wire.read(); // receive a byte as character j++; } Wire.endTransmission(); // stop transmitting}
/* read a single byte from address and return it as a byte */byte readRegister(uint8_t address){ byte data;
// From MMA8452Q Datasheet, Table 10. I2C Device Address Sequence// Command [6:1]Device Address [0]SA0 [6:0]Device Address R/W 8-bit Final Value// Read 001110 0 0x1C 1 0x39// Write 001110 0 0x1C 0 0x38// Read 001110 1 0x1D 1 0x3B// Write 001110 1 0x1D 0 0x3A
Wire.beginTransmission(MMA8452_ADDRESS); // Open communications with device Wire.write(address); // write register address Wire.endTransmission(false); // don't send a stop
Wire.requestFrom(MMA8452_ADDRESS, 1); data = Wire.read(); // Get MSB result Wire.endTransmission(); // stop transmitting return data;}
/* Writes a single byte (data) into address */void writeRegister(unsigned char address, unsigned char data){ Wire.beginTransmission(MMA8452_ADDRESS); // Open communications with device Wire.write(address); // write register address Wire.write(data); Wire.endTransmission(); // stop transmitting}
…
om/2015/05/13/wifi-module-esp8266-2-tcp-client-server-mode/
2- comunicação entre VÁRIOS módulos "ESP8266"
http://www.dobitaobyte.com.br/como-fazer-rede-mesh-com-esp8266-parte-i/
http://www.espressif.com/sites/default/files/30a-esp8266_mesh_user_guide_en.pdf
3- "ESP8266" através do "MIT app inventor"
ESP8266 Controlled with Android App:
http://randomnerdtutorials.com/esp8266-controlled-with-android-app-...
4- velocidade máxima possível entre dois módulos ESP8266
A velocidade dependerá do alcance do sinal
ESP8266 - alcance do sinal de RF:http://labdegaragem.com/forum/topics/conhecendo-o-esp8266?commentId...
Meu Tutorial sobre ESP8266 :
http://labdegaragem.com/forum/topics/conhecendo-o-esp8266
ESP8266 - Comunicação de dados TCP/IP:http://labdegaragem.com/forum/topics/conhecendo-o-esp8266?commentId...
ESP8266 - Comunicação WEB Server:http://labdegaragem.com/forum/topics/conhecendo-o-esp8266?commentId...
ESP8266 - Teste de comunicação serial do Arduino com o ESP8266 :http://labdegaragem.com/forum/topics/conhecendo-o-esp8266?commentId...
ESP8266 - Usando IDE Arduino (exemplos ADAFRUIT/SPARKFUN )http://labdegaragem.com/forum/topics/conhecendo-o-esp8266?commentId...…
rém quando vou testar na protoboard o a há 06 parece não se comunicar com o arduino através dos pinos rx tx, liguei corretamente o pino tx do há 06 ao pino 2 do atmega e o rx ao 3 do atmega, e ambos estão con alimentação correte . (Obs: já testei o efeito blink e funcionou normalmente na protoboard, porém o problema está sendo o mesmo que o do Herlio, caso alguém possa ajudar ficarei muito grato valeu, fiquem com Deus.…
ta porque fica travando tentei usar outro app mas não (arduino bluethooth) este segundo consigo parear mas não funciona vou deixar o code que estou usando com o primeiro app
#define START_CMD_CHAR '*'#define END_CMD_CHAR '#'DIV_CMD_CHAR #define '|'#define CMD_DIGITALWRITE 10#define CMD_ANALOGWRITE 11#define CMD_TEXT 12#define CMD_READ_ARDUDROID 13#define MAX_COMMAND 20 // max comando código numérico. utilizado para a verificação de erros.#define MIN_COMMAND 10 // comando código mínimo número. utilizado para a verificação de erros.#define IN_STRING_LENGHT 40#define MAX_ANALOGWRITE 255#define PIN_HIGH 3#define PIN_LOW 2
Corda Intext;
void setup () { Serial.begin (9600); Serial.println ("Alpha ArduDroid 0,12 por TechBitar (2013)"); Serial.flush ();}
void loop (){ Serial.flush (); int ard_command = 0; int pin_num = 0; int pin_value = 0;
Char get_char = ''; // Lê série
// Esperar por dados de entrada if (Serial.available () <1) retorno; // Se de série vazia, retornar ao loop ().
// Analisar recebida bandeira de início comando get_char Serial.read = (); if (get_char = START_CMD_CHAR!) return; // Se nenhum comando bandeira de início, voltar a loop ().
// Analisar tipo de comando de entrada ard_command Serial.parseInt = (); // Lê o comando // Analisar recebida pin # e valor pin_num Serial.parseInt = (); // Lê o pino pin_value Serial.parseInt = (); // Lê o valor
// 1) Obter texto COMANDO DE ARDUDROID se (ard_command == CMD_TEXT) { Intext = ""; // Limpa variável para nova entrada while (Serial.available ()) { Char c = Serial.read (); // Recebe um byte de buffer serial atraso (5); if (c == END_CMD_CHAR) {// se a seqüência completa foi lido // Adicionar seu código aqui parar; } outro { if (c! = DIV_CMD_CHAR) { Intext + = c; atraso (5); } } } }
// 2) Obter digitalWrite DADOS DE ARDUDROID se (ard_command == CMD_DIGITALWRITE) { if (pin_value == PIN_LOW) pin_value = LOW; else if (pin_value == PIN_HIGH) pin_value = alta; else return; // Erro no valor do pino. Retorna. set_digitalwrite (pin_num, pin_value); // Descomente essa função se você deseja usar Retorna; // Retorna a partir de início de loop () }
// 3) OBTER DADOS DO analogWrite ARDUDROID se (ard_command == CMD_ANALOGWRITE) { analogWrite (pin_num, pin_value); // Adicionar seu código aqui Retorna; // Feito. voltar ao loop (); }
// 4) enviar dados para ARDUDROID se (ard_command == CMD_READ_ARDUDROID) { // Carvão send_to_android [] = "Coloque seu texto aqui." ; // Serial.println (send_to_android); // Exemplo: Envio de texto Serial.print ("Analog = 0"); Serial.println (analogRead (A0)); // Exemplo: Ler e enviar Analog valor pin ao Arduino Retorna; // Feito. voltar ao loop (); }}
// 2a) selecionar o pino # solicitada para a ação digitalWriteset_digitalwrite void (int pin_num, int pin_value){ switch (pin_num) { Caso 13: pinMode (13, OUTPUT); digitalWrite (13, pin_value); // Adicionar seu código aqui parar; Caso 12: pinMode (12, OUTPUT); digitalWrite (12, pin_value); // Adicionar seu código aqui parar; Caso 11: pinMode (11, OUTPUT); digitalWrite (11, pin_value); // Adicionar seu código aqui parar; Caso 10: pinMode (10, OUTPUT); digitalWrite (10, pin_value); // Adicionar seu código aqui parar; Caso 9: pinMode (9, OUTPUT); digitalWrite (9, pin_value); // Adicionar seu código aqui parar; Caso 8: pinMode (8, OUTPUT); digitalWrite (8, pin_value); // Adicionar seu código aqui parar; Caso 7: pinMode (7, OUTPUT); digitalWrite (7, pin_value); // Adicionar seu código aqui parar; Caso 6: pinMode (6, OUTPUT); digitalWrite (6, pin_value); // Adicionar seu código aqui parar; Caso 5: pinMode (5, OUTPUT); digitalWrite (5, pin_value); // Adicionar seu código aqui parar; case 4: pinMode (4, OUTPUT); digitalWrite (4, pin_value); // Adicionar seu código aqui parar; case 3: pinMode (3, OUTPUT); digitalWrite (3, pin_value); // Adicionar seu código aqui parar; case 2: pinMode (2, OUTPUT); digitalWrite (2, pin_value); // Adicionar seu código aqui parar; // Padrão: // Se nada mais jogos, faça o padrão // Default é opcional }}…