UPDATE !! UPDATE !!UPDATE !!UPDATE !!
From ESPBasic Version 3.0 Alpha 43 you have also the i2c.setup function available!!

i2c.setup(): Will change the default pins for the i2c interface.

i2c.setup({SDA}, {SCL})

—————————————————————————————————-

From today I will start a new Series related with ESP Basic (www.esp8266basic.com)

When working with a lot of I2C devices one of the first thing that you need is a simple I2C scanner that can help you to identify the IC’s and do some very basic troubleshooting.

What we will need: 

    • ESP8266 nEXT EVO Board
    • ESP8266 nEXT EVO – Analog Extension Board – AN1 (I2C devices onboard to test our scanner )
    • For programming and uploading the driver and the software we will use ESP8266 Basic .  
                                           nEXT EVO + AN-1 extension board

      I2C Scanner Software:

      i2c.setup(4,5) --0.43 and up!
      for address = 1 to 127
         i2c.begin(address)
         stat = i2c.end()
      
         if stat < 1 then
           ' print stat
            wprint "Found I2C device at address: 0x" & hex(address)
            wprint " - > " & address
            wprint " <br>"
       endif
      next
      wait




      As you can see, has properly detected the I2C devices that are on the AN-1 Extension board:

      PCF8574      – 8Bit I/O EXT port      – found at address 0x20 -> 32
      LM75           – Temperature sensor    – found at address 0x48 -> 72
      MCP4728    – 4x12Bit DAC              – found at address 0x60 -> 96
      MCP3421    – 18Bit ADC                  – found at address 0x68 -> 10

Please keep in mind that in ESP Basic you have hardcoded I2C pins yet, SDA -> GPIO0 and SCL -> GPIO2.

Don’t forget to add if needed pullup resistors on both lines, 4K7 should be OK. In case of AN-1 they are NOT needed.


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 – Part 3 – DAC

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard ESP Basic program example for the Extra DAC version configuration: address = 96 Read more…

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 – Part 2

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard ESP Basic program example for the basic version configuration: 'write("starttimer",10) cls 'VCNT GPIO Read more…

ESPBasic

ESPBasic – Web Interface – CSS elements example

A quick example on how to change your Web interface GUI objects properties without using a separate CSS file: Reading Humidity and Temperature from a DHT22 Sesor connected to the GPIO5 and also retrieving Date Read more…