D1 Mini Analog Shield

Add 12 analog pins to the D1 Mini ESP8266 board

Similar projects worth following

The ESP8266 is a very nice chip, but the single 1V analog pin is not very useful. This shield is designed to add a dozen 12-bit analog pins.

  • LUA Example

    ðeshipu02/19/2018 at 21:58 0 comments

    And the same example for the NodeMCU LUA:

    function read_channel(channel)
        i2c.address(0, 0x35, i2c.TRANSMITTER)
        i2c.write(0, bit.bor(bit.lshift(channel, 1), 0x61))
        i2c.address(0, 0x35, i2c.RECEIVER)
        high =
        low =
        return bit.bor(bit.lshift(, 0x0f), 8), low)
    i2c.setup(0, 1, 2, i2c.SLOW)
    while (true) do

  • Python Example

    ðeshipu02/19/2018 at 21:46 0 comments

    The same example in MicroPython for the ESP8266:

    import machine
    def read_channel(i2c, channel):
        if not 0 <= channel <= 11:
            raise ValueError()
        data = i2c.readfrom_mem(0x35, 0x61 | (channel << 1), 2)
        return ((data[0] & 0x0f) << 8) | data[1]
    i2c = machine.I2C(-1, sda=machine.Pin(4), scl=machine.Pin(5))
    while True:
        print(read_channel(i2c, 0))

  • Arduino Example

    ðeshipu02/19/2018 at 19:26 0 comments

    This is an example Arduino sketch that keeps reading from channel 0 and printing the result on the serial console.

    #include <Wire.h>
    #define ADC_I2C_ADDRESS 0x35
    uint16_t readChannel(uint8_t channel) {
        if (channel >= 12) {
            return 0;
        Wire.write((channel << 1) | 0x61);
        Wire.requestFrom(ADC_I2C_ADDRESS, 2);
        uint8_t high =;
        return ((high & 0x0f) << 8) |;
    void setup() {
    void loop() {

  • Finally

    ðeshipu09/27/2017 at 12:07 0 comments

    So the PCBs from DirttyPCBs never arrived. They made me wait for them for 8 weeks, and then sent a replacement, which also never arrived. After further 4 weeks of waiting, I thanked them, closed the support ticket, and ordered the PCBs at Seeed Studio. Whatever new shipping method they have now, it doesn't seem to be working in my country very well. I don't think I will be ordering from them anymore.

    On the bright side, the PCBs from Seeed just arrived, and I have assembled and tested one, so they should appear in the Tindie store very soon (I just need some time to assemble and test a bunch).

  • Waiting for the PCBs

    ðeshipu07/07/2017 at 22:00 0 comments

    The chips have already arrived, the Tindie page is prepared, now I'm just waiting for the PCBs to arrive. It's been over 6 weeks already, and I'm starting to get nervous about them. Dirty PCBs never took that long before, except for that time around the Spring Festival, of course, but that's expected.

  • Production PCBs Ordered

    ðeshipu05/29/2017 at 05:17 0 comments

    Having gotten the prototypes to work, I panelized and ordered the PCBs for the "production" version:

    This time I removed one of the tabs, to make sure the board outline is cut correctly. Then I went to my favorite Chinese store looking for the chips to populate this with, and found that I can no longer order them at the price I found them initially. I guess I will wait a little bit and see if they re-appear.

  • That Was Quick

    ðeshipu05/28/2017 at 06:24 2 comments

    At last a project that went smoothly for a change. The MAX1238 chips arrived, and I soldered them to the PCBs and they seem to be working just fine at first sight. I was a bit worried about the chips being too small when I saw them, but they are fine.

    I wrote a very simple MicroPython library to handle this shield:

    class MAX123x:
        def __init__(self, i2c, address=0x35):
            self.i2c = i2c
            self.address = address
        def reset(self):
            self.i2c.writeto(self.address, b'\x80')
        def read(self, channel):
            if not 0 <= channel <= 11:
                raise ValueError()
            data = self.i2c.readfrom_mem(self.address, 0x61 | (channel << 1), 2)
            return ((data[0] & 0x0f) << 8) | data[1]

View all 7 project logs

Enjoy this project?



Kirk Franks wrote 11/22/2017 at 06:02 point

I received my boards today, anxious to fire one up. I see you have a python library, is it on GitHub? Would you happen to have a library for the Arduino IDE? Do you have schematics or hookup information available.



  Are you sure? yes | no

ðeshipu wrote 11/22/2017 at 09:32 point

Hi, I don't really have any libraries, because the reading from it is so simple, but I can see how they would be useful just to get people started quick. I will add example code for Arduino and the schematics etc. as soon as I'm back from vacation next week.

  Are you sure? yes | no

Kirk Franks wrote 11/22/2017 at 20:33 point

That would be great. I just need something to bring me up to speed on using your shield. Have a nice vacation.

  Are you sure? yes | no

ðeshipu wrote 02/19/2018 at 19:14 point

Of course I forgot about all this as soon as I got back. I just saw this comment again now, and checked that I didn't add any examples. Sorry about that!

  Are you sure? yes | no

davedarko wrote 04/27/2017 at 05:38 point

always cool to see another D1 mini shield by you :)

  Are you sure? yes | no

ðeshipu wrote 04/27/2017 at 11:18 point

thanks, I'm just scratching my own itches with them

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates