Good day community.
I'm trying to send sensor data to IBM WATSON IOT using ESP8266-E01 wifi module and Arduino Uno. The code seems to work well except for the fact that the ultrasonic sensor reading is always ZERO. I'm assuming the ESP8266 isn't able to read the digital inputs. Any assitance will be highly appreciated
Attached is my code
Try hardcoding a value to send, just to make sure data is getting from the Arduino to the ESP8266 -> to the cloud.
I'm concerned because I don't see how the 8266 is connected, but it normally talks over serial. But you're also using the Uno's only serial port for debugging, and I see no sign of a softwareSerial instance.
Put another way - I'm not convinced ANYTHING is making it to the cloud, so it's just showing you the default starting value of 0.
Edit: Your recent post about the wiring confirms it.
Where is your level shifter? You are liable to damage the esp8266 putting a 5v output onto it! At least put a resistor (1k is fine) in series with the Arduino's TX line...
In serial, you have to cross RX and TX - one side's RX goes to other side's TX (they stand for Receive and Transmit - you want what one side transmits to be received by the other. You can actually damage parts by connecting TX to TX, because you're tying two outputs that will frequently have different values together).
Wait, I'm confused, is that the sketch on the Arduino Uno, with the ESP8266 running the default FW, or is that sketch running on the ESP8266 (in which case the uno is sitting there doing nothing?)
DrAzzy:
Wait, I'm confused, is that the sketch on the Arduino Uno, with the ESP8266 running the default FW, or is that sketch running on the ESP8266 (in which case the uno is sitting there doing nothing?)
not for nothing. I am sure, the sensor is connected to Uno
DrAzzy:
Try hardcoding a value to send, just to make sure data is getting from the Arduino to the ESP8266 -> to the cloud.
I'm concerned because I don't see how the 8266 is connected, but it normally talks over serial. But you're also using the Uno's only serial port for debugging, and I see no sign of a softwareSerial instance.
Put another way - I'm not convinced ANYTHING is making it to the cloud, so it's just showing you the default starting value of 0.
Edit: Your recent post about the wiring confirms it.
Where is your level shifter? You are liable to damage the esp8266 putting a 5v output onto it! At least put a resistor (1k is fine) in series with the Arduino's TX line...
In serial, you have to cross RX and TX - one side's RX goes to other side's TX (they stand for Receive and Transmit - you want what one side transmits to be received by the other. You can actually damage parts by connecting TX to TX, because you're tying two outputs that will frequently have different values together).
DrAzzy:
Try hardcoding a value to send, just to make sure data is getting from the Arduino to the ESP8266 -> to the cloud.
I'm concerned because I don't see how the 8266 is connected, but it normally talks over serial. But you're also using the Uno's only serial port for debugging, and I see no sign of a softwareSerial instance.
Put another way - I'm not convinced ANYTHING is making it to the cloud, so it's just showing you the default starting value of 0.
Edit: Your recent post about the wiring confirms it.
Where is your level shifter? You are liable to damage the esp8266 putting a 5v output onto it! At least put a resistor (1k is fine) in series with the Arduino's TX line...
In serial, you have to cross RX and TX - one side's RX goes to other side's TX (they stand for Receive and Transmit - you want what one side transmits to be received by the other. You can actually damage parts by connecting TX to TX, because you're tying two outputs that will frequently have different values together).
I did hardcoding of 0s and 1s using the A0 of the Arduino, and it was uploaded to the cloud. I'm using a breadboard power supply for the 3.3v of the ESP8266. I tried connecting RX to TX and vice versa, i got gibberish in my serial monitor
What are you even doing with the arduino Uno in this configuration then?
It sounds like you're just running code on the ESP8266. So pick an unused pin on the esp8266, connect the sensor to that, adjust code, and remove the uno.... Assuming pulseIn works on esp8266, at least.
DrAzzy:
What are you even doing with the arduino Uno in this configuration then?
It sounds like you're just running code on the ESP8266. So pick an unused pin on the esp8266, connect the sensor to that, adjust code, and remove the uno....
Okay. Then use TX and RX and don't turn on the serial?
OH! I see why you've got it wired that way, you're using the arduino uno just as a serial adapter?
Or use an ESP8266 in a module that isn't so lousy? WeMos D1 Mini clones are like $3 a pop on ebay! All pins broken out, builtin serial adapter, better PCB antenna and a shield.
DrAzzy:
Okay. Then use TX and RX and don't turn on the serial?
OH! I see why you've got it wired that way, you're using the arduino uno just as a serial adapter?
Or use an ESP8266 in a module that isn't so lousy? WeMos D1 Mini clones are like $3 a pop on ebay! All pins broken out, builtin serial adapter, better PCB antenna and a shield.
Alright will check out the WeMos. In the meantime isn't they anything i could to with the code?
DrAzzy:
Okay. Then use TX and RX and don't turn on the serial?
OH! I see why you've got it wired that way, you're using the arduino uno just as a serial adapter?
Or use an ESP8266 in a module that isn't so lousy? WeMos D1 Mini clones are like $3 a pop on ebay! All pins broken out, builtin serial adapter, better PCB antenna and a shield.
Got the Wemos D1 board. Works fine. Thanks for your input