ESP32-WROOM-32
Rick Murray (539) 13840 posts |
Okay, I have to get up early tomorrow so I’m going to call it a day… The demo “advanced server” code is installed, it says a quick hello message, then builds a random SVG file (it’s not recording anything, that’s just made up). For now the ESP32 is hanging off the USB power supply: http://heyrick.ddns.net:81/ It’s surprising how little code is required to get that working. Not like a certain OS we all know and love. ;-) Edit: If you see the drawing with lots of diagonal lines in odd places, it’s not my ESP, it’s NetSurf… |
Rick Murray (539) 13840 posts |
I should add – what I’d like to do is hook one of these things to the Linky smartmeter to provide details of current consumption (read from the TIC). I had originally planned to use the ESP2866 (or whatever it is) but was concerned about the small memory capacity. Instead, the ESP32 is a more powerful device (way overpowered for this, I think), but on the other hand it has a decent amount of memory so some code could assemble HTML documents on the go, plus maintain a history to a reasonable degree of detail? I was hoping to use Lua (which I don’t know!) because I could develop the code directly on the device, perhaps via RISC OS. It’d be a lot less fuss than using the Arduino IDE. However, AIDE works…finally. ;-) This, of course, is not the hard bit. Anybody who knows about EDF’s TIC will know that it’s a pretty weird implementation of a sort-of-serial port. I forget, what is it, data stream modulated onto a 64kHz carrier? It’s something nutty like that… |
Tristan M. (2946) 1039 posts |
Lol I know that Web page. I used the same example as a template for the esp8266 based egg hatcher I made. |
Rick Murray (539) 13840 posts |
Given I’m a software nerd who’s handy with a screwdriver, this totally quirks my interest. Did you ever write it up? URL? |
Tristan M. (2946) 1039 posts |
Pretty sure I still have the source locally. There is however a significant chance it is on the hard drive of my desktop which is only local in the classic sense right now. I’ll check the network drives. If I do find it just know it is a hack. I had a few hours to conceive and build the hardware and software. After that a few fixes were done to hardware and software but that was it. One thing I recall clearly is that you have to be careful when basing code off that example. I had issues with code being blocking initially. Weird issues like the code only executing when I was viewing the web page or when it was connected to Wifi. Basically what the code did was monitor the temperature and humidity via an i2c sensor. if the hatcher got below a threshold it would turn on the peltier device and external heatsink fan until the upper threshold was reached. I could monitor the temp and humidity via the web interface. It was all the basis of the idea for an incubator I’d had, and the incomplete list of parts I’d collected at the time. It was enough to make something that worked well enough to save some chicks that the mother hen had stopped sitting on that were due to hatch. The hardware is based off an esp8266 board with widely spaced parallel pins. I used it as a daughterboard. it plugs into another board with the voltage regulators etc which are in between the pin rows on the bottom board. IIRC I needed 5v and 3v3. e: neat! There’s an arm64 version of Arduino now. much later edit: Many toolchains haven’t been built for aarch64 including stm32 and esp32. You made me want to put a Lua back on one of the esp32s. Looks like it’s going to be a bit of a PITA with only really my Pinebook to use. |
Colin (478) 2433 posts |
I plugged my CP2102 device into my Windows 10 laptop and monitored the rts and dtr lines. The results were interesting. The Yellow line is DTR and the Blue RTS. There is no comms program running on the PC. The trace starts with the device plugged in then I unplug the device and plug it in again. The first vertical rise happens the moment I plug it in so the bit twiddling happens over a 4.5 second period then remains in the logic 0 state. Running a comms program with nohandshake doesn’t change these lines. SerialUSB just stays at high voltage (logic 0) after being plugged in. On opening a device there is a 640 micro second period when the voltage is low (logic 1). Using the rtsdtr version of SerialUSB with rtsdtr=0 SerialUSB never asserts logic 1. Make of that what you will with regard to setting dtr/rts for your use. |
Colin (478) 2433 posts |
It looks like a very slow I2C yellow is the clock and blue the data. |
Dave Higton (1515) 3526 posts |
No, that’s not normal for IIC. The data line would not change on the rising edge of the clock. |
Rick Murray (539) 13840 posts |
Do you “initialise” the port in any way? This may be happening under Windows too, but the device is assigned a COM number whichever I guess means the driver has automatically “opened” it. I’m not sure what can be done next – the reset is seen by the USB stack as a disconnect/reconnect so it gets a new ID |
Colin (478) 2433 posts |
Not before a device is opened. Once it’s opened baudrate, data format etc are all set. Nothing is sent over rx and tx. Are you using a Pi? If you are powering a vonets device and this device from the Pi you may be having power problems. My interest has been piqued – I’ll have to send for one. |
Rick Murray (539) 13840 posts |
Using a Pi2, the Vonets is powered from the separate big supply that runs everything.
Mmm, yes. The ESP32 sounds interesting. I should add that my board seems to have an issue with the DTR pin – I need to hold the Boot button to get it to enter programming mode. |
Rick Murray (539) 13840 posts |
Played with the “sketch” this evening. It will now pulse the blue LED slowly, once startup has been successful (and connected to AP). The output document now includes the current date and time (read from NTP) and reports the core temperature. The hard part is getting information on the SDK. Had to Google to find out how to use the (incorrectly spelled) “temprature” sensor. Declare it as extern “C” with the function name following. Yes, that’s clear and self-evident. ;-) There’s also a call to getLocalTime which doesn’t appear to be in any of the header files. Hmmm… Also got rid of the rubbish random SVG. |
Steve Pampling (1551) 8170 posts |
Sounds like the input is sort of floating in neither a 1 nor 0 state and giving you a “random” selection of 1 or 0. I’d pop a resistor around 47k1 between the DTR and ground to pull it toward the state it achieves when you press the button (which grounds it) and when DTR is expressed as a 1 it still behaves as expected. 1 It’s an old timers thing, you always grab a 470, 4k7, 47k, 470k… |
Tristan M. (2946) 1039 posts |
It’s running at about 50*C. I never realised they ran that hot. You said sketch, so you are using Arduino. So which SDK are you referring to? I can’t look for myself because the toolchain isn’t built for aarch64. Edit. I’m no arduino expert. I’m just curious what you are doing. |
Rick Murray (539) 13840 posts |
I wonder if knocking back the clock speed would help? It’s not as if I need it to run at 200MHz.
It’s the Arduino IDE with ESP32 additions, patched to run under XP… |
Tristan M. (2946) 1039 posts |
Thanks for the inspiration! I managed to coax nodemcu lua on to an early esp-01 module I had. Honestly thought it was fried, but after a lot of fiddling around on a breadboard it started to respond again. I just used a cloud built binary that I tested on a nearly as useless WeMos D1 v1. |
Colin (478) 2433 posts |
My DevKitC ESP32 Just arrived. I needed to tell SerialUSB about the CP2102N that it uses. It wasn’t recognised initially but then it worked fine with my serialterminal program using the -crlf option.
I suppose I’ll have to figure out how to load the AT firmware.
|
Rick Murray (539) 13840 posts |
Where did you get that firmware? Mine won’t respond to AT commands – just starts up as SoftAP and sits there (apparently it uses some other serial port). |
Colin (478) 2433 posts |
I haven’t changed the firmware it didn’t respond to AT commands – other than reply |
Rick Murray (539) 13840 posts |
Strange. My default startup was completely different (as seen from first post). If you have esptool running on a PC, you can take a copy of your flash: esptool.py -p COM5 read_flash 0 0x400000 flashfile.bin |
Colin (478) 2433 posts |
Haven’t got a clue what I’m doing at the moment. I’m following the Get Started guide on the expressif web side. It’s taken over and hour to make the hello_world example then it fails to connect to put the program on the device. Hmmm…. VROOM 1 Colin 0 |
Colin (478) 2433 posts |
Ok, holding the ‘boot’ button while it is saying “connecting _____….” seems to do the trick you can let go once it is connected. So it all ended in an equitable draw after 90 mins VROOM 1 Colin 1 |
Rick Murray (539) 13840 posts |
Ah, it’s the same as mine then. You need to hold it when the dots turn to dashes (or vice versa). The interesting thing is that DTR is supposed to assert that so nothing needs held. Does your device not reset itself when opening the port under RISC OS?
That’s using their own dev kit? Oh thank you. That makes me feel better about my server code taking around five minutes to compile. ;-) I ought to write this stuff up on my blog… BTW, there’s details of the programming protocol on the espressif wiki if you feel like having a go at reading/writing the flash under RISC OS. It uses SLIP, believe it or not! Oh, and if you want to play with the embedded BASIC, pull GPIO12 (I think that’s the fourth one up on the left with USB at the bottom) high and hit reset. |
Colin (478) 2433 posts |
I’m trying to load esp32-at at the moment so that I can play around on my imx6 but it keeps failing to compile.
No I have no problems opening the device on my imx6. I’ve recompiled SerialUSB so that is compiles with the standard AcornC/C++. It appears I’d been compiling it with a rom environment set up by !Builder – it may possibly make a difference. Whatever the quality of your power supply I’d still try a plugging the device into a separate powered hub – just to eliminate power problems caused by pi USB. |
Steve Pampling (1551) 8170 posts |
I did suggest a pull down resistor to eliminate any indeterminate logic state situation arising from leakage currents. Otherwise the input may be in that zone between logic 0 and logic 1. |