Monday Morning at the Lab

Just in case anyone in the UK or EU is even remotely interested, I just put up my little pocket scope on Ebay. http://www.ebay.co.uk/itm/231492939705

Meanwhile talking of Ebay, the Raspberry Pi is currently working a treat on THIS little number…. a cheap WIFI dongle.  http://www.ebay.co.uk/itm/331400872324 -  it’s been running overnight and logging temperatures without a hitch. For under £4 that can’t be bad.  I’m thinking, once I get the Pi and the ESP8266 boards properly communicating over MQTT of putting a display on the Pi and making that the wall unit rather than hiding it away. Well, clearly, I’d rather NOT have to have a network cable going up the wall so the WIFI dongle solves a problem.

my ESP-12 units turned up – still waiting for some little adaptor boards to come that give you 0.1” pitch from the ESP-12s for experimenting.  It seems that it is necessary to ground GPIO-12 as well as taking the PD line high permanently – and I had confirmation yesterday that using GPIO-0 with a ground-based setup (for example an NPN transistor and resistor arrangement is NOT a good idea – personally I’ve been using then to power solid state relays taking the other side of the relay to positive hence ensuring a small amount of positive voltage at power up – and I’ve had no problems.  I plan also to tie GPIO16 to the external reset so I can experiment with the low power sleep mode. All of that late this week when my adaptors arrive.

Oh, I knew there was something else. Has anyone doing C coding with ESP8266s used this yet? Seems like a fine way to mess with ESP8266 GPIOs – giving you a consistent interface to handle GPIO 0,2, 4,5, 12,13 and 14. The author says he HAS used this with SDK 0.9.5 so it is pretty much up to date. As soon as I get my adaptors for the ESP-12s I’ll give it a good thrashing.  https://github.com/eadf/esp8266_easygpio

Facebooktwittergoogle_pluspinterestlinkedin

40 thoughts on “Monday Morning at the Lab

  1. I used an ESP-07 (the same PINs as ESP-12).

    I used TX/RX, GPIO0,2,4,5,12,13,14, even 16 at the same time. They worked.
    GPIO00: IR LED
    GPIO02: DS18B20
    GPIO04: Push button
    GPIO05: I2C SDA
    GPIO12: rotary encoder
    GPIO13: rotary encoder
    GPIO14: I2C SCL
    GPIO16: Relay output

      1. Pete,
        I found it myself, too (for example IoT_demo).

        George

        Usage for output:
        gpio16_output_conf(); // set as output
        gpio16_output_set(0); // set low
        gpio16_output_set(1); // set high

        Content of gpio.c to be included:

        #include "ets_sys.h"
        #include "osapi.h"
        //#include "driver/gpio16.h"

        void ICACHE_FLASH_ATTR
        gpio16_output_conf(void)
        {
        WRITE_PERI_REG(PAD_XPD_DCDC_CONF,
        (READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC to output rtc_gpio0

        WRITE_PERI_REG(RTC_GPIO_CONF,
        (READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable

        WRITE_PERI_REG(RTC_GPIO_ENABLE,
        (READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe) | (uint32)0x1); //out enable
        }

        void ICACHE_FLASH_ATTR
        gpio16_output_set(uint8 value)
        {
        WRITE_PERI_REG(RTC_GPIO_OUT,
        (READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe) | (uint32)(value & 1));
        }

        void ICACHE_FLASH_ATTR
        gpio16_input_conf(void)
        {
        WRITE_PERI_REG(PAD_XPD_DCDC_CONF,
        (READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC and rtc_gpio0 connection

        WRITE_PERI_REG(RTC_GPIO_CONF,
        (READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable

        WRITE_PERI_REG(RTC_GPIO_ENABLE,
        READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe); //out disable
        }

        uint8 ICACHE_FLASH_ATTR
        gpio16_input_get(void)
        {
        return (uint8)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);
        }

  2. Hi,

    Interesting you are thinking of a display on the Pi. I wanted to do this for my openenergymonitor system which diverts PV and has dashboards for my heat bank temperatures.

    There were some interesting notes a while ago about using cheap displays of the kind used in cars for reversing cameras or even for video for the kids. Take a look at this thread which explains how to get the Pi to boot to displaying a home page on this type of monitor -> http://openenergymonitor.org/emon/node/5824

    With the addition of a couple of buttons it must be possible to cycle through a few pages.

    Simon

    PS keep up the interesting blogging, I'm building a heat bank and central heating controller along the same lines as you and Martin Harizanov, so really appreciate the insights.

    1. Hi Simon, I was thinking of one of those displays that will show up the graphical interface - they're not bad. I just realised that the likes of HighCharts can be run locally... and I can produce half decent graphs - would be nice to have on the wall. Tell me about your heating controller. Up to now I have 2 on-off times, peak, offpeak and frost and I'm adding in the ability to take temperature from a remote unit...

      1. The idea behind the link above was to display any web page, so it doesn't have to be local, it could also be remote. So any page displaying your graphs, or in my case the page displaying my dashboard.

        you would have to do some messing about to make it look OK as these aren't high res. Here's an example which is 4.3" and 320 by 240 pixels -> http://www.ebay.co.uk/itm/4-3-Inch-TFT-LCD-Color-Screen-Monitor-for-Car-Rear-View-Reversing-CCTV-Camera-UK-/181170533714?pt=LH_DefaultDomain_3&hash=item2a2e9af552

        1. Ah, I just spotted an issue... NICE display - very nice for the Raspberry Pi... but the new Pi 2 - does not actually have a video out like that. It has just a modern HDMI output...

          1. On the B+ the RCA socket was replaced by a 4 way for sound and video. You need a special cable for this. Can't remember now where I bought one from, I'll have to trawl through my old emails.

            I was assuming the Pi2 simply replicated this. I will check.

  3. PS I found an arduino prototyping board with a central patch at 2mil pitch with the outside area at 0.1" pitch. From memory it was from HK. I can dig out the ebay link if you are interested. I'm planning on using this with the esp8266 in the middle and the rest of the components round the outside and a separate relay board.

    This might be an option for your projects

    Simon

    1. The link would be good Simon - I was sure I'd ordered some kind of prototyping boards but maybe not as they're not here. I really don't fancy using veroboard...

  4. Indeed the board is neat... I would consider getting some made but the ones out there are so cheap. I'm waiting for a few to arrive (I checked last night I had ordered 5 from Ali Express)... just for testing and ultimately I could see a board with power supply (5v switched then 3v3 linear, ESP and some kind of Atmel chip.

    Ok so check this - note the resistors - and note the price is CHEAP.

    http://www.aliexpress.com/item/5pcs-lot-ESP8266-serial-WIFI-module-connecting-plate-applicable-to-ESP-07-the-ESP-08-ESP/32262955010.html

    1. Hi, not sure why you would want an Atmel chip on there. Given the price point surely you'd have lots of them doing discrete things joined up through MQTT and Openhab or similar rather than creating a larger system doing lots of things.

      Also on the boards, if you search on 8266 on OSH Park there are quite a few boards out there. This one could be really interesting, has a regulator and USB socket built in if I'm reading it correctly. https://www.oshpark.com/shared_projects/HyYJSvDb

      With the 03 packaging this could be very useful.

      1. Tyler get plus points for a lot of things on that board. The Microchip LDO regulator has a quiescent current of only 80uA, the USB connector is though-hole (much sturdier for something which is probably going to get plugged in and out a lot during development), no connection to the external antenna pin and the on-board antenna stands clear of the top of the board. Good stuff!

        Unfortunately, there are a couple of minus points, too. The top layer of the board appears to be the "bottom" (the power and user LEDs are on the bottom layer, so presumably that should be the top side when in use). That means that the pin outs of the carrier board are really difficult to identify from the "top" when the carrier is actually plugged into something (take a look at the position of GPIO0 in relation to GPIO2, 13, 14 and 15). Excellent regulator choice and then a hard-wired power LED? (okay, you don't have to populate it).

        It probably does what Tyler intended it to very well and it gets extra points for pricing, too. 🙂

        Just as an aside (this is -not- a problem with the board, only with my eyes :-)), when I first saw this board I dismissed it out of hand because I couldn't for the life of me see the ground connection to pin-8 of the ESP. I had to hunt down Tyler's Kicad files to see that it actually does connect to the bottom of the pad (partially obscured by the silk-screen of the ESP outline). For anyone wanting to check Tyler's project, it's up on GitHub at:- https://github.com/Insomniac10102/ESP8266-WiFi-Relay

      2. HI Simon... Atmel chip - driving RGB Serial LEDs. I've a version of the MQTT software running that can pass messages out through the serial... and hence the ability to manage soft fades of RGB serial LEDS - if this was done on the ESP8266 because of the extreme load (0.3 us for the narrow pulses) it would affect incoming communication - most stuff I can do on the ESP8266.

        That OSH PARK board looks nice - other than being for the 03 - might be worth re-working that for the ESP-12 boards. Never thought of putting the regulator etc on the other side.

        1. Couldn't you offload the fade to one of those RF led RGB controllers and simply use an RF transmitter with the 8266. Then you'd just have to send the right command. Although of course you'd be stuck with the fade as defined by the led controller and would need to find one that has been hacked.

          Just a thought, might make things simpler, although if you already have code that works on an ardiono then I guess that's the easiest route.

          1. Hi Simon

            The only RGB controllers I'm aware of (at least at the dirt cheap end) are for 12v PWM leds and are infra-red. If you do know of a controller that costs just "a few pounds (I can put together an Atmel board for something under £3 (you can BUY the very small Arduino boards for that amount) which gives me one or more RGB serial channels, some PWMs and optional relay outputs - and the likes of FASTLED library do it all for you - all you need to add is a serial command parser which is a doddle.... so I see these as an extension of a set of ESP MQTT control boards which are perfectly able to do the more trivial relay+temperature+humidity stuff.

          2. Thanks Simon - you are indeed right some of them are RF - the majority are IR which I already use (well, you never know, the Internet might fail and you still have to control the lights)... erm but I think the ones you showed there are for PWM controlled lights - not the serial 5v ones....

            But thanks for the links - I didn't know about the RF ones and those controlling the 12v PWM LEDs could well find this useful.

  5. I am using the SDK development board that is used for ESP201. I confirm that the gpio available are 0,2,4,5,12,13,14. I didn't try with gpio1 and 3 but can be used if no debugging is needed. Gpio 16 is connected to vcc. Gpio15 is hardconnected to gnd.

  6. Thanks for that BCatalin - how are you finding the ESP201? I found the WIFI range was awful... and the dev board wanted to be a USB device and moved my mouse across the screen!!

    1. It is a nice board if you accept with few problems( can't use red led and the relay on it, serial to usb is very slow). I am using an external usv to ttl connected to rx, tx and gnd. Can see the temp at volk.ro.

    2. Just a quickie. Are you using an external antenna? The 201s can use the onboard antenna or an external antenna. The shipping default is for the external antenna. If, like me, you want to use the onboard antenna you need to move a 0ohm surface mount resistor. it is the size of a grain of rice and a right pain! I lost mine and ended up having to solder a minute jumper between the 2 smd pads, not easy. Why they were not designed to have a simple jumper to select the required antenna is beyond me!

      If you are using the external antenna make sure that the boards you have got are not from the batch with a production error which shorts out the antenna.

      In both cases to see what I am on about see : - http://smarpl.com/content/esp8266-esp-201-module-antenna-troubleshooting

      1. Hold the phone - you mean that out of the box the little board doesn't use the on-board aerial! That accounts for a lot!!! Right- I'm in meetings now until Friday but I'll give the board another look - it really would have helped had it arrived with ANY INFO. I got the aerial, the baseboard and the 201 board - and that's it - I've no idea what to do with the DIP pins on the base board, what is attached to what... etc...

        Well this DOES explain a lot. Now I just need to know why the baseboard insists on acting like a mouse when you plug it into the USB lead - making editing almost impossible when it's plugged in. No doubt another undocumented feature.

        1. Hi Peter

          I only have the 201 board, no base board. I talk to it with a TDI FT232RL USB to TTL Serial Converter Adapter Module, just like an ESP-01.

          I got the pinout info etc here :- http://smarpl.com/content/esp8266-esp-201-module-first-impressions. I got a fuller pinout here :- http://4.bp.blogspot.com/-qQuP4g_JzBM/VNYi94m1ozI/AAAAAAAAAOA/PDV1qBnp5lY/s1600/ESP201_Front.jpg.

          I did refer to the smarpl.com info in a comment to the blog item “The Battle of the ESP-201 Giants”. This is not a criticism, I know that this info is arriving left right and centre and it is easy to miss or forget a bit of information.

          Keep up the good work.

          1. Sometimes I get so much coming in I can't keep up 🙂 Right now the continued apparent lack of signal prevents me finding any use for these board in comparison to the excellent ESP-12 - incidentally, the ADC - the function call seems to return 1024 at around 1.024v - I've not tested that - just guessing from the test potentiometer. Goes down to zero as you'd expect and to be honest it looks pretty stable. I reckon with a resistive divider so that full scale was maybe 20.48v you'd have a useful measure of any reasonable battery or solar cell voltage.

        2. Peter

          You say that the board insists on acting like a mouse.

          That is likely to be a Windows driver problem. Windows has, presumably, identified your board as a mouse and installed what it thinks is the correct driver. Not an unknown problem!. Time to get into Device Manager and find out what is happening.

          It should be easy to uninstall the driver. Where you get the correct driver from..............?

  7. Catalin - what a hero - that is JUST what I needed. I have a base board and two of the 201 boards. Armed with this info and the knowledge that the internal aerial wasn't connected I can look at these boards afresh over the weekend. Also my adaptor for the ESP-12 has turned up so I'll document my findings - meanwhile others may care to check Catalin's link above - marvelous info...

  8. I'm wondering if anyone has any thoughts on PWM - I'm using it on Pin 15 and the problem is it is flickering when I update RGB serial leds which require interrupts turned off in the middle of the serial loop.... so I'm assuming from this that PWM is handled in software under interrupts - am I right?

    Pete.

Comments are closed.