Wednesday, May 3, 2017

ESP8266 USB Programmer USBProg


USBPrg v8.4 -  a fully isolated SAFE USB to Serial adapter for communcation and programming devices protecting your USB ports and devices.


The perfect companion for a complete Development platform for your projects!

Now available on TINDIE Store: https://www.tindie.com/products/nEXT_EVO1/usbprgv84-isolated-usb-serial-programmer-adapter/

You can buy it a special price in the MPRSx8 Home Automation Development pack - MPRSx8 Dev Board + USPPrgv8.4  programmer: https://www.tindie.com/products/nEXT_EVO1/wifi-8x-mains-relays-board-for-home-automation/


------------------------------------------------------------------------------------------------------------------

What is it?

 

  A fully isolated USB to Serial adapter for communication and also programming devices protecting your USB ports and connected devices.
  Integrated hardware Autoreset function makes it suitable for direct programming ESP8266, ESP32 and other MCU's that require it.
  If you use Arduino IDE/Platformio/etc for example with ESP8266, you will love it, as it doesn't need to press anymore RST/Prog buttons for new sketch upload! The autoreset function takes care of that, putting automatically the ESP8266 module in the right boot mode.


Youtube Video step-by-step Tutorial on how to use it to program a ESP8266 Module:



 In the case above ESP8266 is embedded on a MPRSx8 Home Automation board but in the same easy way can be used for programming standalone ESP8266 modules.


Pinout



      Capabilities

    • Fully isolated interface
    • High speed (can work OK also at 115200 and up - used it with Arduino IDE/Platfromio at 921600)
    • DTR/RTS/autoreset function
    • 2.5 kV RMS integrated digital isolator from Silicon Labs
    • High electromagnetic immunity
    • Ultra low power
    • Schmitt trigger inputs
    • Transient Immunity 50 kV/μs

     

    Schematics

    USB interface



    Digital isolator



    Auto-reset circuit


    Below you can find also the wiring for the MPRSx8 Home Automation Board Programming:







    Monday, April 24, 2017

    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 Himidity and Temperature from a DHT22 Sesor connected to the GPIO5 and also retrieving Date and Time from NTP Server:

    PinDHT = 5
    DHT.SETUP(22, PinDHT)

    cls

    timer 1000, [branch] ' ## Time for auto refresh variables ##

    wprint |<body style="background-color:powderblue;">|
    wprint |<H1><span style="color: red;">|
    wprint "Example for changing GUI object properties with CSS"
    wprint "</H1>"
    wprint "</span>"

    wprint "<table border='1'><tr><td>Date</td><td>"
    textbox Dtm
    cssid htmlid(), "background-color: yellow;display:block;width:160px"
    wprint "</td></tr><tr><td>Humidity </td><td>"
    textbox Hum
    cssid htmlid(), "background-color: grey;color:#F00;display:block;width:40px"
    wprint "</td></tr><tr><td>Temperature Deg C</td><td>"
    textbox Temp
    cssid htmlid(), "background-color: #ccaabb;display:block;width:40px"

    wprint "</td></tr></table><p>"

    wprint "<p> Click to Exit <br>"
    button "Exit", [TestExit]

    Wait


    [TestExit]
    timer 0
    end

    [branch]
    gosub [readdata]
    wait

    [readdata]
    Dtm = time() 'Current Date and Time
    Temp = DHT.TEMP() 'Current Temperature
    Hum = DHT.HUM() 'Current Humidity


    The result looks as below:






    Friday, April 21, 2017

    ESPBasic Series: Web Interface Slider demo


    How easy or complicated is in ESPBasic to have a instant response slider for your MPDMv4 AC Dimmer Web interface?

    Just look at the code below:
    cls
    let xpv = 0
    let PWMpin = 5
    slider x,150,900
    timer 500, [set.dimmer]
    wprint "<br><br>"
    button " Exit ", [TestExit]

    wait

    [set.dimmer]
     if x <> xpv then
       io(pwo,PWMpin,x)
       xpv = x
     end if
    wait

    [TestExit]
    wprint |<a href="./edit"> Edit</a>|
    end

     Yes, it's all there, plus some extras :)

    The Power of ESPBasic !

    Friday, April 14, 2017

    Part 2 - Raspberry Pi + Domoticz AC Dimmer


         ---------------------------------------------------------------------------------------------------------------------------

                           Special April Sale Discounts!!


    Special Spring Sale discounts for all the products available on Tindie Store:
    https://www.tindie.com/stores/nEXT_EVO1/

    Including the popular MPDMv4 Universal AC Mains Dimmer and the MPRSx8 Home Automation Board!

    Spread the word and use Coupon code: NDSCVO10

    Thank you all for your support!

     ---------------------------------------------------------------------------------------------------------------------------


    Part 2 of the tutorial: Raspberry Pi + Domoticz + MPDM v4 AC dimmer board.


    Part 2 topic: Domoticz setup & final testing :





    What we will need:

    - MPDMv4 Universal AC Dimmer - available also on Tindie Store !
    - Raspberry PI 2 Board

    - PIGPIO library for Raspberry PI  - take a look at Part 1 how to install and test
    - Domoticz
       Latest available, on a Raspberry PI 2 Board install :  
         sudo curl -L install.domoticz.com | bash



    Software 

    Domoticz LUA script for RPi Dimmer:

    commandArray = {}
    DomDevice = 'RPi_Dimmer';
    if devicechanged[DomDevice] then
       if(devicechanged[DomDevice]=='Off') then
         print ("OFF dimm = "..uservariables['dimm']);
         CalcValue = 860*1000;
       else if(devicechanged[DomDevice]=='On') then
            DomValue = uservariables['dimm'];
            print ("ON dimm = "..uservariables['dimm']);
            CalcValue = DomValue;
          else
             print("Other");
             DomValue = otherdevices_svalues[DomDevice];
             CalcValue = (900-(DomValue*9))*1000;
             commandArray['Variable:dimm'] = tostring(CalcValue);
    --         commandArray['Variable:dimm'] = CalcValue;
             print ("dimm Level = "..uservariables['dimm']);
       end
       end
       runcommand = "pigs hp 18 400 " ..tonumber(CalcValue);
       print("PWM calculated value= "..CalcValue);
       print("Run command: " ..runcommand);
       os.execute(runcommand);
    end
    return commandArray

     Save it as "script_device_RPi_Dimmer.lua" in the "domoticz/scripts/lua" folder !









    --------------------------------------------------- DISCLAIMER --------------------------------------------------
    WARNING!! You will play with LIVE MAINS!! Deadly zone!! 
          If you don't have any experience and are not qualified for working with MAINS power I will not encourage you to play arround!. The author take no responsibility for any injury or death resulting, directly or indirectly, from your inability to appreciate the hazards of household mains voltages.
       The circuit diagrams are as accurately as possible, but are offered with no guarantees whatsoever. 
        There is no guarantee that this design meets any Rules which may be in force in your country so please check before your local rules/regulations.
    ----------------------------------------------------------------------------------------------------------------------------
     
                                                                 Creative Commons License

    All materials and boards released under ESP8266-Projects.com are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License 





    Wednesday, April 5, 2017

    Raspberry Pi + Domoticz AC Dimmer - Part 1


         ---------------------------------------------------------------------------------------------------------------------------

                           Special April Sale Discounts!!


    Special Spring Sale discounts for all the products available on Tindie Store:
    https://www.tindie.com/stores/nEXT_EVO1/

    Including the popular MPDMv4 Universal AC Mains Dimmer and the MPRSx8 Home Automation Board!

    Spread the word and use Coupon code: NDSCVO10

    Thank you all for your support!

     ---------------------------------------------------------------------------------------------------------------------------



    New Tutorial related with direct connection setup between Raspberry Pi board and MPDM v4 AC dimmer board.

    Part 1: General view, wiring and hardware setup :



    What we will need:

    - MPDMv4 Universal AC Dimmer - available also on Tindie Store !
    - Raspberry PI 2 Board
    - Domoticz
       Latest available, on a Raspberry PI 2 Board install :  
         sudo curl -L install.domoticz.com | bash


     

    Software 

    1. PIGPIO library for Raspberry PI install script:
    rm pigpio.zip
    sudo rm -rf PIGPIO
    wget abyz.co.uk/rpi/pigpio/pigpio.zip
    unzip pigpio.zip
    cd PIGPIO
    make -j4
    sudo make install
    save it in the choosen directory for your PIGPIO library as "install.sh" and run also command:
    chmod 775 install.sh

    2. Testing script:
    #!/usr/bin/env python

    #*** MPDMv4 Universal AC Dimmer PWM Example  ****************
    #*                                                          *
    #* This demo is using RPi2 GPIO18 (header pin 12)!!         *
    #*                                                          *
    #* Wiring table:                                            *
    #* MPDMv4      Raspberry PI 2                               *
    #*   VCNT  ->  GPIO18      - header pin 12                  *
    #*    GND  ->  GND         - header pin 6                   *
    #*    VCC  ->  VCC (+3,3V) - header pin 1                   *
    #*                                                          *
    #* tech@esp8266-projects.com                                *
    #*                                                          *
    #************************************************************
     
    import pigpio

    GPIO=18

    pi = pigpio.pi()

    if pi.connected:
       print("Connected to pigpio daemon !\n")

    dm = 0
    while dm < 860:
        dm = input("Enter Dimmer Value: ")
        dm = int(dm)
        pi.hardware_PWM(GPIO, 5000, dm*1000) # 5000Hz dm*1000% dutycycle

    print("\nOut of range. Exiting...")
    pi.hardware_PWM(GPIO, 5000, 860000) # 5000Hz 95% dutycycle
    pi.stop()


    save it as "test.py" in the PIGPIO folder generated after the full install is done.


    Next time: Domoticz setup & configuration and Dimmer testing.



    --------------------------------------------------- DISCLAIMER --------------------------------------------------
    WARNING!! You will play with LIVE MAINS!! Deadly zone!! 
          If you don't have any experience and are not qualified for working with MAINS power I will not encourage you to play arround!. The author take no responsibility for any injury or death resulting, directly or indirectly, from your inability to appreciate the hazards of household mains voltages.
       The circuit diagrams are as accurately as possible, but are offered with no guarantees whatsoever. 
        There is no guarantee that this design meets any Rules which may be in force in your country so please check before your local rules/regulations.
    ----------------------------------------------------------------------------------------------------------------------------
     
                                                                 Creative Commons License

    All materials and boards released under ESP8266-Projects.com are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License 




    Monday, April 3, 2017

    Special Spring Sale Discounts!!



    Special Spring Sale discounts for all the products available on Tindie Store:
    https://www.tindie.com/stores/nEXT_EVO1/

    Including the popular MPDMv4 Universal AC Mains Dimmer and the MPRSx8 Home Automation Board!

    Spread the word and use Coupon code: NDSCVO10

    Thank you all for your support!

    Friday, March 24, 2017

    Thingspeak - SmartMon Ext Board P4

    This is Part 4 of the SmartMon Extension Board series.

    SmartMon v2.7ex Board  is a extension board fully compatible with Arduino, ESP8266, ARM, PIC & other available MCu's out there.  As long as your MCU/Dev Board has I2C Bus capabilities you are good to go!
    It is probably one of the easiest ways to create your own Voltage/Current and Power consumption monitoring system for your Projects, devices, batteries, power supplies and many more!


    UPDATE !! SmartMon v2.7Ex is available also on Tindie Store !





    This time we will go thru a full example on how to monitor your power line and load, read Voltage/Current and Power consumtion data and upload them on the Thingspeak related Channel.

    Previous Articles:


    What we will need:


    Software implementation:

    Thingspeak channels or standalone Thingspeak Server setup part is not covered in this article.
     If interested to see how can be done a standalone Thingspeak Server, please take a look here:
    1. RaspberryPI - Standalone Thingspeak Server install
    2. RaspberryPI2 - Thingspeak Server install on Jessie 


    To make it running, you need also the function from the previous article:

    Part 3: INA219 Driver and a simple data read example 


    Send data to Thingspeak function
    function sendDataTh()
        print("Sending data to thingspeak.com")
        conn=net.createConnection(net.TCP, 0)
            conn:on("receive", function(conn, payload) print(payload) end)
            -- api.thingspeak.com 184.106.153.149
            conn:connect(80,'184.106.153.149')
            conn:send('GET /update?key=T89U8XLJDPQTW0AR&field1='..volt..'&field2='..current..'&field3='..power..'&field4='..peng..'HTTP/1.1\r\n')
            conn:send('Host: api.thingspeak.com\r\n')
            conn:send('Accept: */*\r\n')
            conn:send('User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n')
            conn:send('\r\n')
            conn:on("sent",function(conn) print("Closing connection")
            conn:close()
        end)
        conn:on("disconnection", function(conn) print("Got disconnection...")
        end)
    end 


    Main Program
    ---- INA216 Module TEST
    init_i2c()
    setCAL_reg()
    print_values()
    If you want to read and update values every minute add function from below:
    tmr.alarm( 1, 60000, 1, function()
         print_values()
         sendDataTh()
    end)
    You can stop your running timer anytime with:
    tmr.stop(1)

    Thursday, March 16, 2017

    Smart Mon Ext Board - Software example - P3

    This is Part 3 of the SmartMon Extension Board series.

      SmartMon v2.7ex Board  is a extension board fully compatible with Arduino, ESP8266, ARM, PIC & other available MCu's out there.  As long as your MCU/Dev Board has I2C Bus capabilities you are good to go!
    It is probably one of the easiest ways to create your own Voltage/Current and Power consumption monitoring system for your Projects, devices, batteries, power supplies and many more!


    UPDATE !! SmartMon v2.7Ex is available also on Tindie Store !






    Previous Articles:


    What we will need:


    Software implementation

    1.  INIT Data
    id = 0
    sda = 2
    scl = 1
    devaddr = 0x40   -- A0,A1 = GND

    voltage = 0
    current = 0
    power = 0
    peng = 0
    eng = 0

    2. I2C  Init function 
    function init_i2c()
      i2c.setup(id, sda, scl, i2c.SLOW)
    end

    3. INA219 Reset function
    function reset()
      write_reg(0x00, 0xFFFF)
    end

    4. Read register function
     --read from reg_addr content of dev_addr
    function read_reg_str(reg_addr)
      i2c.start(id)
      i2c.address(id, devaddr, i2c.TRANSMITTER)
      i2c.write(id,reg_addr)
      i2c.stop(id)
      tmr.delay(1)
      i2c.start(id)
      i2c.address(id, devaddr, i2c.RECEIVER)
      c=i2c.read(id, 16) -- read 16bit val
      i2c.stop(id)
      return c
    end

    5. Read register function - 16bit--returns 16 bit int
    function read_reg_int(reg_addr)
      i2c.start(id)
      i2c.address(id, devaddr, i2c.TRANSMITTER)
      i2c.write(id,reg_addr)
      i2c.stop(id)
      tmr.delay(1)
      i2c.start(id)
      i2c.address(id, devaddr, i2c.RECEIVER)
      local c = i2c.read(id, 16) -- read 16bit val
      i2c.stop(id)
      --convert to 16 bit int
      local val = bit.lshift(string.byte(c, 1), 8)
      local val2 = bit.bor(val, string.byte(c, 2))
      return val2
    end

    6. Write register function
    function write_reg(reg_addr, reg_val)
      print("writing reg:" .. reg_addr .. ", reg_val:" .. reg_val)
      i2c.start(id)
      i2c.address(id, devaddr, i2c.TRANSMITTER)
      local bw = i2c.write(id, reg_addr)
      local bw2 = i2c.write(id, bit.rshift(reg_val, 8))
      local bw3 = i2c.write(id, bit.band(reg_val, 0xFF))
      i2c.stop(id)
    end

    7. Calibration / settings function
    function setCAL_reg()
      maxVoltage = 32
      maxCurrentmA = 10000
      write_reg(0x05,3950) --CALIBRATE FOR YOUR rshunt & stuff
      local config = 15391
      write_reg(0x00, config)
    end

    8. Read Current values (mA)
     function getCurrent_mA()
      local valueInt = read_reg_int(0x04)
      return valueInt
    end

    9. Read Bus Voltage (V)
     function getBusVoltage_V()
      local valueInt = read_reg_int(0x02)
      -- Shift to the right 3 to drop CNVR and OVF and multiply by LSB = 4
      local val2 = bit.rshift(valueInt, 3)
      local val2 = val2 * 4
      return val2 * 0.001
    end

    10. Read Shunt resistor voltage drop (mV)
    function getShuntVoltage_mV()
      -- Gets the raw shunt voltage (16-bit signed integer, so +-32767)
      local valueInt = read_reg_int(0x01)
      return valueInt * 0.01
    end

    11. Read Bus Power (W) 
    function getBusPowerWatts()
      local valueInt = read_reg_int(0x03)
      return valueInt*20*0.001
    end

    12. Print read values 
     function print_values()
      volt = getBusVoltage_V()
      print("\nVoltage  :  " .. volt.." V")
      current = getCurrent_mA()/1000
      power = getBusPowerWatts()
      if (current > 65 ) then
             print("ERR 00.23")
             current = 0
             power = 0
      end
      eng = eng + power/60
      print("Current  : " .. string.format("%6.3f",current) .." A")
      print("Power    :  " .. power .." W\n")
      print("Energy   : " .. string.format("%6.3f",eng) .." Wh\n")
    end

    MAIN Program
    ---- INA216 Module TEST
    init_i2c()
    setCAL_reg()
    print_values()

    If you want to read and update values every minute add function from below:

    tmr.alarm( 1, 60000, 1, function()
         print_values()
         sendDataTh()
    end)
    You can stop your running timer anytime with:
    tmr.stop(1)




    That's all for today, next time we will more further and we will go thru a full SmartMon Battery Monitor System + Thinkspeak data upload example.
     


    Creative Commons License All schematics, boards, software and articles released by ESP8266-Projects.com are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License









    Thursday, March 9, 2017

    MPRSx8 - P4 - Domoticz configuration



    MPRSx8 Board is available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/

    For MPRSx8 general presentation and hardware description please take a look also at Part 1 of the MPRSx8 series:http://www.esp8266-projects.com/2016/11/wifi-mains-8x-relay-board-for-home.html



    Part 4 of the MPRSx8 + ESPEasy Tutorial - After having all the bits & pieces in place, ESPEasy Formware properly uploaded and configured, now is time for the Domoticz setup and testing the Control interface!






    What we will need:
             - CP2102 version
             - Another even smaller size version
             - extra pinout version
             - FT232 Version - Full pinout. Looks nice but because of the FTDI horror stories I would probably stay away from it.


    Thank you all for watching and see you next time! If you like my Articles and Tutorials please subscribe!

    Happy breadboarding,
    TJ.

    The MPRSx8 - Home Automation DevBoard - Domoticz ESPEasy

    The MPRSx8 - Home Automation DevBoard meets Domoticz !

    MPRSx8 Board is available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/

    For MPRSx8 general presentation and hardware description please take a look also at Part 1 of the MPRSx8 series:http://www.esp8266-projects.com/2016/11/wifi-mains-8x-relay-board-for-home.html



    Part 3 of the MPRSx8 + ESPEasy Tutorial - This time we will take a deeper look on the ESPEasy Firmware configuration and preparing the MPRSx8 Board for Domoticz integration:




    What we will need:
             - CP2102 version
             - Another even smaller size version
             - extra pinout version
             - FT232 Version - Full pinout. Looks nice but because of the FTDI horror stories I would probably stay away from it.


    Here you can find Part 4: Domoticz configuration and final tests

    Friday, February 24, 2017

    ESPBasic Series : Decimal-to-Binary conversion


       I was looking a while ago to implement some Decimal-to-Binary conversion subroutine to be used for easy visualisation of the Registry content. Been able to see the values directly binary can help a lot when developping a driver for a IC or any piece of related software:


    1. Decimal-to-Binary subroutine:
     [decbin]
      i = 1
      r = 0
      binval = 0
      nr = decval
     Do
       r = nr % 2
       nr = int(nr/2)
       binval = binval + r*i
       i = i*10
     Loop while nr > 0
    wait

      2. Test Program:
    decval = 0
    binval = 0
    wprint "<br><br>Decimal value "

    textbox decval
    button " Convert ", [decbin]

    wprint "<br><br> Binary value "
    textbox binval
    wprint "<br><br>"
    button " Exit ", [TestExit] 
    Wait

    [TestExit]
     Looking forward to see your own ideas about!

    Happy breadboarding,
    TJ.

    Friday, February 17, 2017

    MPRSx8 - ESPEasy Firmware P2 - Upload with standard USB-to-Serial Adapter

    The MPRSx8 - Home Automation DevBoard meets ESPEasy Firmware :)

    MPRSx8 Board is available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/

    For MPRSx8 general presentation and hardware description please take a look also at Part 1 of the MPRSx8 series:http://www.esp8266-projects.com/2016/11/wifi-mains-8x-relay-board-for-home.html



    Part 2 of the series, ESPEasy Firmware Upload tutorial using a simple standard USB-to-Serial Adapter:





    The story behind:
     
       Somebody was asking if is really possible to upload firmware with a simple USB to serial adapter, as the ones that are available all over the place. As you can see from the above step-by-step tutorial it is possible and is working very smooth. You are loosing the autoreset and autoupload capabilities of the USBProg board, but as long as you are doing rarely the firmware upload is not so bad. 
       On the other hand, if you want to use it with Arduino IDE or anything else that means frequent upload then I think you will start looking after that functions sooner or later, I think more sooner than later :) 


    What we will need:
             - CP2102 version
             - Another even smaller size version
             - extra pinout version
             - FT232 Version - Full pinout. Looks nice but because of the FTDI horror stories I would probably stay away from it.


    Next time we will move further with the ESPEasy firmware configuration, see here Part 3: ESPEasy Firmware configuration for Domoticz integration.

    Thursday, February 16, 2017

    ESPBasic Series - DEC to BCD and BCD to DEC conversions


    In the process of working on a new Driver Tutorial for the ESPBasic Series I am looking today to implement some Decimal-to-BCD and BCD-to-Decimal subroutines.

    What I have done so far:

    1. BCD-to-Decimal subroutine:
    [DEC]
    hv = val >> 4
    hl = val and 15
    val = hv*10 + hl
    wait 
     2. Decimal-to-BCD subroutine:
    [BCD]
    d = int( val / 10 )
    d1 = d * 10
    d2 = val - d1
    val = d*16 + d2
    wait

     3. Test Program
    let val = 96
    textbox val
    button "To DEC", [DEC]
    button "To BCD", [BCD]
    wprint "<br><br>"
    button " Exit ", [TestExit]
    wait

    [TestExit]
    end


    If you have any other idea please feel free to share it, looking forward to see smarter solutions that that. I'm sure they are!

    Happy breadboarding,
    TJ.

    Thursday, February 9, 2017

    ESPEasy Series - MPRSx8 Home Automation Board - Part 1


    The MPRSx8 - Home Automation DevBoard meets ESPEasy Firmware :)

    MPRSx8 Board is available also on Tindie store: https://www.tindie.com/stores/nEXT_EVO1/

    For MPRSx8 general presentation and hardware description please take a look also at Part 1 of the MPRSx8 series:http://www.esp8266-projects.com/2016/11/wifi-mains-8x-relay-board-for-home.html



    Part 1 of the series, ESPEasy Firmware Upload tutorial:





    What we will need:
    Next time we will see how to upload ESPEasy firmware using a standard USB adapter.



    Monday, January 9, 2017

    ESPBasic driver example for AT24C32 - I2C EEPROM


    Do you remember the widely used DS3231 RTC Module

    As you might rememeber we have identified onboard an EEPROM chip, a 32k AT24C32 one and have written some driver examples for LUA 

    I was looking a few days ago for a I2C EEPROM to do some tests with ESPBasic and the results...can be seen below :)

    1. MAIN Program
    cls
    i2c.setup(4,5)                    'choose your I2C bus pins

    let eeprom_address = 0    'EEPROM memory start address
    i2c_address = 87              ' 0x57 - AT24C32 I2C address
    let i = 0
    stw = "87654321"            'string that we want to save in EEPROM

    button "i2c Read",[I2C_read]
    button "i2c Write",[I2C_Write]
    wait

    2. EEPROM READ Function





    [I2C_read]
      stwl = len(stw)
      print "Reading from I2C address " & i2c_address
      adrh = eeprom_address >> 8
      adrl = eeprom_address and 255

      i2c.begin(i2c_address)
      i2c.write(adrh)
      i2c.write(adrl)
      i2c.end()

      i2c.begin(i2c_address)
      i2c.requestfrom(i2c_address,stwl)
      tr = i2c.available()
      print "Available bytes :" & tr
      do
          i2c_read = i2c.read()
          readt = i2c_read-48
          print  "Read value : " & readt
          i = i + 1
      loop while i < tr
      i = 0
      i2c.end()
      print "Read complete"
    wait


    3. EEPPROM WRITE function

    [I2C_Write]
     print "Writing to I2C address " & i2c_address

     stwl = len(stw)
     print "String : " & stw
     print "String Lenght : " & stwl

     adrh = eeprom_address >> 8
     adrl = eeprom_address and 255

     i2c.begin(i2c_address)
     i2c.write(adrh)
     i2c.write(adrl)

     i = 1
     do
         stru = mid(stw,i,1)
         print  "Value to Write: " & asc(stru)
         i2c.write(asc(stru))
         i = i + 1
     loop while i < stwl+1
     i = 0
     i2c.end()
     print "Write complete"
    wait

    Of course, this is just a proof of concept driver example for the I2C 24C32 EEPROM but I think might help you with a good start :)



    Happy breadboarding,
    TJ.