Espruino Wifi v1.1 #5445
Replies: 1 comment
-
Posted at 2016-09-27 by samppa Ok got it working with:
But the behavior is the same as with separate ESP8266 module: HTTP request is well received and handled by this code, but response does not arrive to browser when making the request:
Console says "Client served with: ...", but that response never arrives to chrome browser that I am testing with. What is wrong with the code above or the setup (EspruinoWifi plugged into laptop USB)? Posted at 2016-09-27 by samppa Also the web server tries to respond only once and does not even get the following requests until reset.. Posted at 2016-09-27 by samppa Serving favicon.ico works multiple times to the browser so what is wrong with the JSON response since that hangs? Posted at 2016-09-27 by ClearMemory041063 Attached file contains code to serve HTML. It does both a Get and Post method. You will need to edit the SSID and router password. The IP address will display in the WebIDE You will need to modify the doGet() function at the bottom to serve your content.
Attachments: Posted at 2016-09-27 by @gfwilliams The setup procedure is documented on http://www.espruino.com/WiFi - I'm afraid the boards that I'm selling right now don't have the 'getting started' card (just the web address on the PCB). I will add one, but I'm a bit busy getting Puck.js out there at the moment so intentionally haven't been pushing EspruinoWifi very much. I'm pretty sure your problem is that you're reading analog values from A2 and A3, which the ESP8266 is connected to (so it'll put those pins into analog input mode, which will then cause the ESP8266 to become unresponsive). If you remove Posted at 2016-09-27 by samppa Yes that was the reason. Posted at 2016-09-27 by @gfwilliams There's a diagram here: http://www.espruino.com/WiFi#pinout The pins marked with blue Anything with a Pink mark is used for other functionality and can't be used. Posted at 2016-09-27 by samppa Is it the same when using ESP8266 as a separate module that A2 and A3 should not be used? By the way, Thanks for the quick solution! Posted at 2016-09-27 by samppa And can I somehow detect if an analog pin is connected or not? Posted at 2016-09-27 by DrAzzy Any pin which you have connected to the ESP8266 should not be used for any other purpose. I don't know how you wired it - if you're using the Pico shim, it does use those same pins (see the pinout chart in http://www.espruino.com/ESP8266 ); I think the pico shim pinout was recycled for the WiFi. If you are not using the Pico shim, only you know which pins you have it connected to. There is not a way to detect if a pin is already "used" for something else. As Gordon noted, the pinout chart marks which ones are unavailable on the board, before you start connecting stuff to it. It would be nice if there were a way to warn the user when they yanked pins out from under something - maybe an E.warnOnModeChange(pin) call that could be put into a module to mark those pins as being used for something? Posted at 2016-09-28 by @gfwilliams
As @drazzy says, yes. The wiring for the Espruino WiFi isn't exactly the same as the shim (so that you have a few more analogs available), but A2+A3 are some of the only UART pins so have to be used. Probably the easiest thing is to figure out which analogs you want to use, and then put them in an array: The whole pin naming is a bit confusing, but Espruino boards use the pin names provided by the chip's manufacturer rather than making up new ones. It's a pain when starting off but makes it a whole lot easier and less confusing if you move on to more advanced things.
Hmm - interesting idea... I wonder whether that would get annoying for some users? I guess there could be a way to explicitly disable it though. Posted at 2016-09-28 by samppa Thanks for the reply and support! The plan is to support old standard zero to 180 ohm analog fuel tank level gauges. (I did the same with Arduino, but it was not reliable enough and hang after awhile and even watchdog did not work.) To measure the resistor sensor it would be connected like this: |------Sensor-----A1 pin The idea was to use 20 ohm resistor as Rref to give enough value range for analog measurement as the sensor resistance varies between 0 and 180 ohms. Do you see any problems in this plan or ideas for improvement? Now I would like to know if there is the resistor sensor connected or not. And then make another standard sensor that works from 30 to 240 ohms range as an alternative option that would be selected with e.g. dip switch for changing the Rref or telling the option to Espruino as digital input so that the values can be scaled accordingly. Posted at 2016-09-28 by @gfwilliams I'm not 100% sure I understand - usually you would do:
Is that what you had planned? The only things I would suggest are:
Posted at 2016-09-28 by @allObjects
Espruino Wifi PINOUT Documentation states as first line:
...and these pins are listed in the PINS NOT ON CONNECTORS. In other words, pins that are not on connectors of the board should not be used (in the code). Purple/Pink... mileage varies with color calibration of the display... :) A subject oriented comment: With a 0..240 Ohm sensor and a current limiting resistor of 20 Ohm, a lot of power / current is used for just one sensor: 165mA... if yo have many of those, you might consider a separate 3.3V supply to not make the board to brown out... Last but not least when running of a regular USB, which supplies only 500mA... and ESP8266 is already consuming a lot of that... (at least during transmitter calibration phase(s)). Depending on the length of the line and the environmental noise, going for a 240 (270) Ohm resistor gives you still an 'incredible' resolution. Regarding placement of the capacitor and 1 KOhm resistor: @gfwilliams, I assume it is 'board-side' of the wires. Posted at 2016-09-28 by @gfwilliams @allObjects good point about the power consumption - that could cause real problems. And yes, the capacitor/1k resistor should be as close to the board as possible. Posted at 2016-10-05 by samppa With 270 Ohm resistor can I use all the analog pins? What would be good step-down converter for 3.3V output? The DC voltage available may vary a lot from 9V to 16V (around 12V) or from 18V to 30V (around 24V), so I need converter that accepts wide input voltage range and stable 3.3V output. Posted at 2016-10-05 by @allObjects All grounds should go to a single point... and because you measure with Espruino, I'd put all grounds to one point where also Espruino GND connects to (as short as possible)... Both power supplies - the Espruino (for controls) and the peripherals (sensors) - go to one point, to which also all sensor grounds and Espruino ground goe (Espruino with as short as possible line). I'd not connect the sensor grounds on the Espruino pin. Intentionally I said both power supplies... I would separate them... or having good filtering / decoupling. From your context I conclude that your power environment is 12 or 24 volts with +4-3V and +6-6V... (Car or Truck/heavy Vehicle DC ...or solar/UPS battery bank). You have options to run different resistors to limit current even more while having full range over 3.3V by the gauge's/sensors max resistance. Going beyond 5 V supply for the sensors, you would have to protect the inputs with some Zener diodes. Depending on the noise and length of sensor line lengths, you could go for higher resistors than 270 ohms... of course all dependent on the accuracy you expect from measures... and shielded wires could help with it. Posted at 2016-10-06 by @gfwilliams In terms of 3.3v power supplies, I can't really recommend anything - it'd just be a matter of checking datasheets. However, with 270 Ohm things would be much better - you wouldn't get full swing on the ADC input, but it's accurate enough that you'd still get a pretty good fuel level reading. I guess each sensor might draw 10mA, so you have loads of room on the Pico's 250mA voltage regulator. It means you can use the Pico's voltage regulator, so you can feed it with higher voltages - 5 to 12 volts might be a good start. You could use a totally standard voltage regulator. For instance ST's L78S05CV looks like it'll take up to 35V in and give you 5v out, so would do you fine. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-09-27 by samppa
I just bought the Espruino Wifi (in order to overcome the problems of using separate ESP8266 module that did not respond to HTTP requests and flashing an upgrade did not work).
I cannot Espruino Wifi board v1.1 to work and cannot find working examples..
This code:
Serial2.setup(115200, { rx: A3, tx : A2 });
var wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) {
I get error: "No 'ready' after AT+RST"
What module name should be used?
It has Espruino 1v87.
Could someone post simplified web server code?
Beta Was this translation helpful? Give feedback.
All reactions