Showing posts with label ST7032. Show all posts
Showing posts with label ST7032. Show all posts

Friday, April 24, 2015

ESP8266 Ultimate DevBoard - Finally Arrived!!




   What do you really expect from a IOT Development board?

   I'm sure most of you will say easy configurable Internet access. Direct Wifi if possible.

   And after that?

   What do you think do you need mostly for your IOT Projects?

   Maybe some sort of easy interaction and data exchange with the real world environment?


  Sounds intriguing to start with so many questions but they are more than legitimate:

  When removing all the bells and whistles, what do we REALLY need to develop the next level of IOT devices?


    If you asked yourself already all these questions, and I'm sure a lot of you has done it already, thinking on your own future projects, what do you think about a IOT Development Board that can offer you at least:



   Sounds good? sounds impossible? Well...I hope that I have, at least for a part of you, one of the right answers below:

CBDB v2 Schematic


  A DevBoard full of functions in a 5x5 size PCB, small enough to easy integrate in your hobbyist workplace ecosystem :)


CBDB V2 DevBoard PCB - TOP


   Latest design review PCBs of the fresh new ESP8266 Dev Board v.2 just landed on my desk and is definitely a next step in Experimenting in the IOT world. Designed with ease of use and flexibility in mind it will offer you endless hours of Experimenting, Programming and Developing your own projects.



     For any new requests please feel free to use as usual: tech at esp8266-projects.com.
     If you want for your own experiments to order CBD v2 EVO bare PCBs only, you can also do it directly at Dirty PCBs, our preferred PCB House:
  http://dirtypcbs.com/view.php?share=5876&accesskey=3d0fd70d53d6dc20c0bf0255f67cde65

     Please keep in mind this is a experimental board, not a commercial product and is offered as it is. If it will burn your house, help the Aliens to abduct you or even eat your cat it's your problem not mine. The old enough ones to remember ALF will understand even deeper the disclaimer :)


  On the TOP side, you can easily directly integrate your LCD or if you want it separate just run it thru a usual cable:
 
CBDB v2 - TOP


     After finished soldering, cleaning and cooling down, this is how is looking the ESP8266 CBDBv2 DevBoard ready for testing  the onboard regulator :



Testing was done with power supplied from a Li-Ion Battery pack and also from a standard 5V SMPS unit under a decent 500mA load. No overheating or nasty oscillations, looks good up to 800mA. Are 800mA warm but the proper calculated double side heatsink area is doing the job right :).


Onboard regulator test - 5V  SMPS Supply


    I know it's a big debate this days about 1A requirement for ESP8266 Modules, but from all my experience and informations, at least with the ESP-07/12 Modules I had in my hands in the latest months, they were never exceed the 250mA margin. In fact, I have one module running for months now as a temperature logger/webserver and the power consumption looks constantly as in the pictures below:

Full drain test with thinkspeak data upload and 1/s direct web access reload



Temperature  Logger supply line monitoring


   I must also admit that I have also some old ESP-01 Modules, never used them, they are indeed looking very power hungry but never had the time to check them how much power they require to properly operate. Or if they are just faulty.

   I have seen before entire batches of faulty ESP8266 modules. Even ESP-07 ones if you remember the story. What I can confirm about these ESP-01 modules is that they cannot be programmed using power directly from my CP2102 USB Adapter, as ESP-07/12. Not enough juice for them. Why? If I will find some time will take a look at them. If is anybody out there that has the answer, please share it with us.


And finally, this is how is looking, ready for firmware upload and first tests:
 ESP8266 DevBoard

Stay tuned for what will follow soon:  firmware uploading and the infamous Blinky test:)



Monday, March 23, 2015

Display Time!! ST7032i - I2C LCD Display Driver



   One of the desired and also needed things in many projects is the availability of a local display to be able to directly see messages, values, results, etc. What we will need to be able to easy interface it with ESP8266 module is a 3V logic level compatible one and if it has genuine I2C interface even better for us as less data lines will be used and will keep our CBDB Dev Board I2C bus consistent.

   A most common type of available I2C displays are the ones based on ST7032/i chip. You can find them in many flavours, from very cheap eBay ones to very expensive industrial/mil grade ones. The one used in this project it's a good quality, high contrast/direct sunlight midrange one. Cannot say exactly the price as it's old stock and was ordered a time ago in big quantities, but somewhere around 8-9$. If is showing interest I can ask supplier for an updated price.


ST7032i I2C 2x16 COG LCD Display

    ST7032i is the I2C interface variant of the ST7032 dot-matrix liquid crystal display controller, can display alphanumeric, Japanese kana characters and symbols and it can be configured to drive a dot-matrix liquid crystal display under the control of a 4-bit, 8-bit or 3/4-line serial interface
microprocessor.

  FEATURES :

  •  5 x 8 dot matrix possible
  •  Low power operation support: 2.7 to 5.5V
  •  Range of LCD driver power: 3.0 to 7.0V
  •  4-bit, 8-bit, serial MPU or 400kbits/s fast
  •  I2C-bus interface - ST7032i
  •  80 x 8-bit display RAM (80 characters max.)
  •  10,240-bit character generator ROM for a total of 256 character fonts(max)
  •  64 x 8-bit character generator RAM(max)
  •  16-common x 80-segment and 1-common x
  •  80-segment ICON liquid crystal display driver
  •  16 x 5 –bit ICON RAM(max)
  •  Wide range of instruction functions: Display clear, cursor home, display on/off, cursor on/off,
     display character blink, cursor shift, display shift, double height font
  •  Automatic reset circuit that initializes the controller/driver after power on and external reset pin
  •  Internal oscillator(Frequency=540KHz) and external clock
  •  Built-in voltage booster and follower circuit (low power consumption )
  •  Com/Seg direction selectable
  •  Multi-selectable for CGRAM/CGROM size Instruction compatible to ST7066U and KS0066U
     and HD44780
  •  Available in COG type

   As you can see from the Features list above the ST7032 is suitable for low voltage supply (2.7V to 5.5V) and is perfectly suitable for any portable product which is driven by the battery and requires low power consumption. Exactly what we are looking for our 3V only ESP8266 module.

Please see ST7032 Datasheet for more details.


  PINOUT :

Default schematic for Vdd = 3V  usage


What we will need:
  • CBDB Board
  • USB adapter (take a look on Part 1 for details how to connect them together)
  • ST7032i LCD Module from above

CBDB DevBoard with ST7032i I2C LCD on Expansion port

For programming and uploading the driver and the software we will continue to use the LuaUploader as before.

Driver implementation:

1. Init I2C interface:

      address = 0x3E
      id = 0

      init_i2c = function (self, sda, scl)
        i2c.setup(self.id, sda, scl, i2c.SLOW)
     end


 
2. Init LCD

    Necessary setup steps for proper initialising the LCD Display :


Init LCD Steps

     init_LCD = function (self)
        self:lcd_command(0x38);      --
function set  basic
        tmr.delay(300);
        self:lcd_command(0x39);  
   -- function set extended
        tmr.delay(300);
        self:lcd_command(0x14);     
-- internal OCS frequency adjustment
        tmr.delay(300);
        self:lcd_command(0x69);      --
contrast set low nible
         tmr.delay(300);
        self:lcd_command(0x54);      --
contrast set high nible / icon / power
         tmr.delay(300);
        self:lcd_command(0x6f);       -- 
follower control
         tmr.delay(200000);
        self:lcd_command(0x0c);      --  display on
        tmr.delay(300);
        self:lcd_command(0x01);      -- clear display
        tmr.delay(350000);
        self:lcd_command(0x06);      -- entry mode set
        tmr.delay(300);
        self:lcd_command(0x02);      -- home
        tmr.delay(1000000);
     end 


3. I/O Basic and LCD Instruction functions:


  3.1 - Send I2C data :

     send_i2c = function(self, value, mode)
         i2c.start(self.id)
         i2c.address(self.id, self.address, i2c.TRANSMITTER)
         i2c.write(self.id, mode)
         i2c.write(self.id, value)      
         i2c.stop(self.id)  
     end


  3.2 - LCD Command

     lcd_command = function(self, value)
        self:send_i2c(value, 0x00)
     end




  3.3 -  LCD Write

     lcd_write = function(self, value)
        self:send_i2c(value, 0x40)
     end


  3.4 -  LCD Clear

     lcd_clear = function(self)
        self:lcd_command(0x01)
        tmr.delay(350000)
     end

  

 3.5 -  LCD SetCursor

     lcd_setCursor = function(self, col, row)
        row_offsets = { 0x00, 0x40, 0x14, 0x54 }
        if ( row > 2 ) then
           row = 2-1   
        end
        self:lcd_command(bit.bor(0x80,(col + row_offsets[row])))
        tmr.delay(300)
     end




For testing, just save the code on ESP as 'st7032i.lua', restart ESP and run:

     require('st7032i')                                --call for new created ST7032i Module Driver
     sda, scl = 2, 1                                    -- declare your I2C pinout
     st7032i:init_i2c(sda, scl)                   -- init I2C Bus
     st7032i:init_LCD()                            -- init LCD. See Datasheet for Reg Values calculation

    -- first test "Hello World!"

     st7032i:lcd_clear()                            -- Clear LCD Instruction
     st7032i:lcd_setCursor(0,1)               -- Set Cursor position(col, row) 
LCD Instruction

     st7032i:lcd_write("Hello World!")   -- Print String "Hello World" at set location

      -- second test - 2 lines print           
      st7032i:lcd_setCursor(2,1)               -- Set Cursor position(col, row)  LCD Instruction
      st7032i:lcd_write("First Line")        -- Print String "" at set location
       st7032i:lcd_setCursor(2,2)              -- Set Cursor position(col, row)  LCD Instruction
      st7032i:lcd_write("Second Line")     -- Print String "" at set location



Run "Hello World!" test

Hello World!
2 lines test



  For printing also our live data values on LCD we will need an additional function to convert data in ascii character codes:

  3.6 -  LCD Print Value

     lcd_print = function(self,col,row,val)
        for i=1,string.len(val),1 do
          self:lcd_setCursor(col+i-1,row)
          self:lcd_write(string.sub(val,i,i))
          tmr.wdclr()
        end
     end

 

For testing, just save again the code on ESP as 'st7032i.lua', restart ESP and run:

     require('st7032i')                                --call for new created ST7032i Module Driver
     sda, scl = 2, 1                                    -- declare your I2C pinout
     st7032i:init_i2c(sda, scl)                   -- init I2C Bus
     st7032i:init_LCD()                            -- init LCD. See Datasheet for Reg Values calculation

     st7032i:lcd_clear()                            -- Clear LCD Instruction
     st7032i:lcd_setCursor(0,1)               -- Set Cursor position(col, row) 
LCD Instruction

     st7032i:lcd_write("Hello World!")    -- Print String "Hello World" at set location


     value=12.739                                     -- our value to print
     st7032i:lcd_print(0,2,value)              -- LCD Print(col, row, value) function call



Print data value on LCD
Test Video :