Thursday, December 10, 2015

ESP8266 nEXT EVO - Analog extension Board - P2



     This is Part 2 of the ESP8266 nEXT EVO Analog Extension Board (AN1)


   In this part we will talk a bit about the nEXT Bus I²C protocol  and we will start also a longer, multi-part discussion about testing procedures and software programming for the AN1 Board devices and functions (I/O Expansion port, Temperature, ADC, DAC, Voltage measurements,etc.






Previous related Articles:



--------------------------------------------------------------------------------------------------------------------------
For any new CBDB orders/requests please feel free to use as usual:
     tech at esp8266-projects.com.


ESP8266 nEXT Evo bare PCB has also been made available directly at Dirty PCBs, our preferred PCB House for experimenting (**):
 http://dirtypcbs.com/view.php?share=9699&accesskey=91d782fd4a10943fd36ecc371c7ff2cd


(**) - Actually you have there 2 Boards for the price of one, a ESP8266 nEXT Evo together with a AN1 nEXT Analog Extension Board that brings you a 18Bit ADC (autoscale 0-40V input!), 4x12Bit DAC, Precison Temperature measurement, 8bit I/O port, etc.  
-------------------------------------------------------------------------------------------------------------------------






 Today topic

  First let's have a very quick look at the nEXT bus protocol: I²C
 
 What is I²C?

     I²C (Inter-Integrated Circuit), pronounced I-squared-C, is a multi-master, multi-slave, single-ended, two-wired serial bus - SDA (data line) and SCL (clock line) -  invented by Philips Semiconductor (now NXP Semiconductors). It is typically used for attaching lower-speed peripheral ICs to processors and microcontrollers.


Features of the I2C-bus:

  • Only two bus lines are required; a serial data line (SDA) and a serial clock line (SCL).
  • Each device connected to the bus is software addressable by a unique address and  simple master/slave relationships exist at all times; masters can operate as master-transmitters or as master-receivers.
  • It is a true multi-master bus including collision detection and arbitration to prevent data corruption if two or more masters simultaneously initiate data transfer.
  • Serial, 8-bit oriented, bidirectional data transfers can be made at up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, up to 1 Mbit/s in Fast-mode Plus, or up to 3.4 Mbit/s in the High-speed mode.
  • Serial, 8-bit oriented, unidirectional data transfers up to 5 Mbit/s in Ultra Fast-mode
  • On-chip filtering rejects spikes on the bus data line to preserve data integrity.
  • The number of ICs that can be connected to the same bus is limited only by a maximum bus capacitance. More capacitance may be allowed under some conditions.

   SDA and SCL signals

    Both SDA and SCL are bidirectional lines, connected to a positive supply voltage via a current-source or pull-up resistor:






   When the bus is free, both lines are HIGH. The output stages of devices connected to the bus must have an open-drain or open-collector to perform the wired-AND function. Data on the I²C-bus can be transferred at rates of up to 100 kbit/s in the Standard-mode, up to 400 kbit/s in the Fast-mode, up to 1 Mbit/s in Fast-mode Plus, or up to 3.4 Mbit/s in the High-speed mode. The bus capacitance limits the number of interfaces connected to the bus.

For a single master application, the master’s SCL output can be a push-pull driver design if there are no devices on the bus which would stretch the clock.


   SDA and SCL logic levels

    Due to the variety of different technology devices (CMOS, NMOS, bipolar) that can be connected to the I²C-bus, the levels of the logical ‘0’ (LOW) and ‘1’ (HIGH) are not fixed and depend on the associated level of VDD.

Input reference levels are set as 30 % and 70 % of VDD; VIL is 0.3VDD and VIH is 0.7VDD.

Timing Diagram for F/S-mode devices on the I²C-bus


   Some legacy device input levels were fixed at VIL= 1.5 V and VIH= 3.0 V, but all new devices require this 30 %/70 % specification.


   For a more deep and extensive I²C protocol undestanding ( Data Validity, START and STOP conditions, Byte format, Acknowledge (ACK) and Not Acknowledge (NACK), Clock synchronisation, etc,etc please take a look at the official NXP I²C  Protocol datasheet.  I²C protocol it is quite a serious separate topic to discuss :).

   Before going further with our main topic I will insist only one one more thing, as it looks it creates a lot of confusion sometime:

     The slave address and R/W Bit (7 bit mode)


    Data transfers follow the format shown in the picture below:

A full data transfer


     After the START condition (S), a slave address is sent. This address is seven bits long followed by an eighth bit which is a data direction bit (R/W) — a ‘zero’ indicates a transmission (WRITE), a ‘one’ indicates a request for data (READ):

The first byte after the START procedure



      A data transfer is always terminated by a STOP condition (P) generated by the master.
However, if a master still wishes to communicate on the bus, it can generate a repeated START condition (Sr) and address another slave without first generating a STOP condition. Various combinations of read/write formats are then possible within such a transfer:

  • Master-transmitter transmits to slave-receiver. The transfer direction is not changed and the slave receiver acknowledges each byte:


  • Master reads slave immediately after first byte. At the moment of the first acknowledge, the master-transmitter becomes a master-receiver and the slave-receiver becomes a slave-transmitter. This first acknowledge is still generated by the slave. The master generates subsequent acknowledges. The STOP condition is generated by the master, which sends a not-acknowledge (A) just before the STOP condition:
 

  • Combined format. During a change of direction within a transfer, the START condition and the slave address are both repeated, but with the R/W bit reversed. If a master-receiver sends a repeated START condition, it sends a not-acknowledge (A) just before the repeated START condition:



  

         Now, after a very brief (very!) I²C protocol presentation, let's go back to our Analog Extension Board:

   
ESP8266 nEXT EVO + AN-1 Boards

 
  First thing that we want to do, after the AN-1 Board is properly soldered, cleaned, visual inspection OK, etc, will be to tests it and validate it as a proper working Board.


 What we will need:


    Connection with the ESP8266 nEXT EVO Board is very easy, as Analog Extension Board - AN1 connector is fully compatible with the nEXT connector. Depending on how to you choose you socket type, you can install it on TOP or Bottom of the ESP8266 nEXT EVO Board :

ESP8266 nEXT EVO Board + Analog Extension Board AN1


   And, if you want, you can continue stacking them on the nEXT Bus, with a SSD1306 OLED Display, for example:

ESP8266 nEXT EVO + AN1 + SSD1306 OLED Display




   Software implementation

    By default, on the AN-1 Board you should have the following available devices:
  • PCF8574 8Bit I/O Extension port  - at address 0x20
  • LM75 Temperature sensor             - at address 0x48
  • MCP4728 - 4x12Bit DAC             - at address 0x60
  • MCP3421 - 18Bit ADC                 - at address 0x68
   When also connected, the SSD1306 OLED Display will be available at 0x3C


   A fist step in testing the AN-1 available functions and devices will be to scan the nEXT I²C Bus and see if all the existing ones are alive and responding to the I²C Master requests. Also will list any new added devices, if alive.


1. Find device function

function find_dev(i2c_id, dev_addr)
     i2c.start(i2c_id)
     c=i2c.address(i2c_id, dev_addr ,i2c.TRANSMITTER)
     i2c.stop(i2c_id)
     return c
end

2. Scan Bus for devices function

 function scanbus()
    i2c.setup(id,sda,scl,i2c.SLOW)
    for i=1,127 do
       if find_dev(id, i)==true then
            if i==32 then
            print("- PCF8574 8Bit I/O Extension port - found at address 0x"..string.format("%02X",i).." -> "..i)
            else
            if i==72 then
            print("- LM75 Temperature sensor         - found at address 0x"..string.format("%02X",i).." -> "..i)
            else
            if i==96 then
            print("- MCP4728 - 4x12Bit DAC           - found at address 0x"..string.format("%02X",i).." -> "..i)
            else
            if i==104 then
            print("- MCP3421 - 18Bit ADC             - found at address 0x"..string.format("%02X",i).." -> "..i)
            else
            if i==60 then
            print("- SSD1306 OLED Display            - found at address 0x"..string.format("%02X",i).." -> "..i)
            else
            print("- NEW UNREGISTERED DEVICE         - found at address 0x"..string.format("%02X",i).." -> "..i)
            end
          end
        end
       end
       end
       end
       tmr.wdclr()
   end
end


 3. MAIN Scanbus Program

id=0
sda=2
scl=1
scanbus()


Next time we will continue with deeper testing and programming for each AN-1 available device/function.



56 comments:

Unknown said...

Thanks for sharing your view to our knowledge’s, its helps me plenty keep sharing…
Regards,
PHP Training Center in Chennai|PHP Course Chennai

Unknown said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
Regards,
web designing training|web designing training in chennai

Unknown said...

Wonderful post!!PHP is abbreviated as Hypertext Preprocessor. It is server side scripting language used for web development.PHP was actually created by Rasmus Lerdorf.PHP code is processed by php interpreter as modules or Common Gateway Interface (CGI). It is also executed by Command Line Interface (CLI).Thank you..!!
Regards,
PHP Training in Chennai | PHP Course in Chennai

geethu said...

Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
web designing course in Chennai | web designing training in Chennai

Unknown said...

Great post!!This blog of information is really helpful.Keep on sharing.
software testing training in chennai | software testing course in chennai

Unknown said...

Wonderful post!!Thanks for sharing this informative blog of post.keep on blogging.
digital marketing course in chennai | digital marketing training in chennai

Unknown said...

Amazing post!!Thanks for sharing your impressive blog of post.keep on sharing.
Dot net training in Chennai | Dot net course in Chennai

Unknown said...

I too always learn something new from your post Great post….thanks for sharing this profitable data..
Best institute chennai

Brave Technologies said...

Thank you for Sharing. We are leading erp software solution providers in chennai. For more details call +91 9677025199. erp in Chennai

for ict 99 said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.

Unknown said...

Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.
Hadoop Training Institute In chennai

amazon-web-services-training-in-bangalore

Unknown said...

I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

https://bit.ly/2qI7TOC

saranya said...

I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
datascience training in chennai

Mathi said...

Thank you for sharing this wonderful blog.
Digital marketing course Chennai | Digital Marketing Training

pooja said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.

Blueprism training in Chennai

Blueprism training in Bangalore

Blueprism training in Pune

Blueprism training in tambaram

Blueprism training in annanagar

Blueprism training in velachery

Blueprism training in marathahalli

pooja said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.

Blueprism training in Chennai

Blueprism training in Bangalore

Blueprism training in Pune

Blueprism training in tambaram

Blueprism training in annanagar

Blueprism training in velachery

Blueprism training in marathahalli

Unknown said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops training in tambaram|Devops training in velachery|Devops training in annanagar|Devops training in sholinganallur

kevin antony said...

Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.


rpa training in Chennai | rpa training in velachery

rpa training in tambaram | rpa training in sholinganallur

sai said...

The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.
python training institute in chennai
python training in velachery
python training institute in chennai

sai said...

It was worth visiting your blog and I have bookmarked your blog. Hope to visit again
python training institute in chennai
python training in velachery
python training institute in chennai

Unknown said...

This is good site and nice point of view.I learnt lots of useful information.
java training in jayanagar | java training in electronic city

java training in chennai | java training in USA

amar said...

PCB Design Training in Bangalore offered by myTectra. India's No.1 PCB Design Training Institute. Classroom, Online and Corporate training in PCB Design
pcb design training in bangalore

Unknown said...

Inspiring writings and I feeling proud about blog, I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
corporate training in bangalore

top 10 corporate training companies in india
myTectra provide to professionals the flexibility to learn at their own time and location, even from their mobile devices. courses are specially curated by experts who monitor the IT industry with a hawk’s eye, and respond to expectations, changes and requirements from the industry, and incorporate them into our courses. Along this we provide interview question and answers to help for students in interview preparation process. Follow the sites you might like our sites
salesforce interview questions
c++ interview questions

Unknown said...

Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.

Data Science course in Chennai | Data science course in bangalore
Data science course in pune | Data science online course
Pyton course in Kalyan nagar

Unknown said...

IOT Training in Bangalore - Live Online & Classroom
IOT Training course observes iot as the platform for networking of different devices on the internet and their inter related communication.

prabha said...

Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…

angularjs Training in chennai
angularjs Training in chennai

angularjs-Training in tambaram

angularjs-Training in sholinganallur

angularjs-Training in velachery

Unknown said...

Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.


AWS Training in Pune | Best Amazon Web Services Training in Pune


Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR,Chennai


AWS Training in Chennai |Best Amazon Web Services Training in Chennai


AWS Online Training | Online AWS Certification Course - Gangboard

Unknown said...

Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.


AWS Training in Pune | Best Amazon Web Services Training in Pune


Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR,Chennai


AWS Training in Chennai |Best Amazon Web Services Training in Chennai


AWS Online Training | Online AWS Certification Course - Gangboard

Unknown said...

Hi what is U6? Part number?
Which IC is used for Auto ranging?
Please provide info regarding Analog frontend!

Unknown said...

I meant U3,
What is the part number?

easylearn said...

Thank you so much for sharing the post.Its very amazing to visit your blog with very good and relevant content.This post is useful for beginners as well as employees.
amazon web services training institute in pune

nash b said...

Nice Post..
final year project proposal for information technology

free internship for bca

web designing training in chennai

internship in coimbatore for ece

machine learning internship in chennai

6 months training with stipend in chennai

final year project for it

inplant training in chennai for ece students

industrial training report for electronics and communication

inplant training certificate

nash b said...

Keep Sharing...
snowflake interview questions and answers

inline view in sql server

a watch was sold at loss of 10

resume format for fresher lecturer in engineering college doc

qdxm:sfyn::uioz:

java developer resume 6 years experience

please explain in brief why you consider yourself suitable for the position applied for

windows 10 french iso kickass

max int javascript

tp link router password hack

akalya said...

nice..

internship for bba students

internship certificate for cse students

internship training in chennai

internships in hyderabad for cse students 2020

r training in chennai

robotics course

internship for ece students in core companies

internship for aeronautical engineering students in bangalore

internship for cse students in bangalore 2019

industrial visits for college students in chennai

akalya said...

good..

how to hack chromebook using crosh

hack tp link wifi username and password

brac ngo written test question

whatsapp ethical hacking

react js developer resume india

integer max value javascript

binatone wifi hack

a certain sum of money amounts to rs.1300 in 2 years and to rs. 1525 in 3.5 years. find the sum and the rate of interest

she spent most of her time tomusic

she most of her time tomusic

hari said...

very nice
inplant training in chennai
inplant training in chennai for it
Bermuda web hosting
Botswana hosting
armenia web hosting
dominican republic web hosting
iran hosting
palestinian territory web hosting
iceland web hosting

raju said...

very nice blogger.......................!!!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
panama web hosting
syria hosting
services hosting
afghanistan shared web hosting
andorra web hosting
belarus web hosting
brunei darussalam hosting

ammu said...

excellent information....!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
brunei darussalam web hosting
costa rica web hosting
costa rica web hosting
hong kong web hosting
jordan web hosting
turkey web hosting
gibraltar web hosting

hari said...

Bermuda web hosting
Botswana hosting
armenia web hosting
lithuania shared web hosting
inplant training in chennai
inplant training in chennai for it
suden web hosting
tunisia hosting
uruguay web hosting

dras said...

Excellent post...
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
Australia hosting
mexico web hosting
moldova web hosting
albania web hosting
andorra hosting
australia web hosting
denmark web hosting

preethi minion said...

very nice.....!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
italy web hosting
afghanistan hosting
angola hosting
afghanistan web hosting
bahrain web hosting
belize web hosting
india shared web hosting

shree said...

superb....
inplant training in chennai for it
namibia web hosting
norway web hosting
rwanda web hosting
spain hosting
turkey web hosting
venezuela hosting
vietnam shared web hosting

hari said...

nice
inplant training in chennai
inplant training in chennai
online python internship
online web design
online machine learning internship
online internet of things internship
online cloud computing internship
online Robotics
online penetration testing

Thiyagu said...

inplant training in chennai
inplant training in chennai
inplant training in chennai for it.php
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting

hari said...

good
inplant training in chennai
inplant training in chennai
online python internship
online web design
online machine learning internship
online internet of things internship
online cloud computing internship
online Robotics
online penetration testing

sibiselvan said...

it is excellent blogs...!!
inplant training for diploma students
mechanical internship in chennai
civil engineering internship in chennai
internship for b.arch students in chennai
internship for ece students in core companies in chennai
internship in chandigarh for ece
industrial training report for computer science engineering on python
internship for automobile engineering students in chennai
big data training in chennai
ethical hacking internship in chennai

Muthu said...

Very Nice...
internship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate


KUTTYMA said...

nice information....

winter internship for engineering students
internship for mca students
inplant training for eee students
inplant training for eee students/
java training in chennai
internships for eee students in hyderabad
ece internship
internship certificate for mechanical engineering students
internship in nagpur for computer engineering students
kaashiv infotech internship
internship for aeronautical engineering students in india 2019

anuarun said...

nice information......
ree internship in bangalore for computer science students
internship for aeronautical engineering
internship for eee students in hyderabad
internship in pune for computer engineering students 2018
kaashiv infotech internship fees
industrial training certificate format for mechanical engineering students
internship report on machine learning with python
internship for biomedical engineering students in chennai
internships in bangalore for cse
internship in coimbatore for ece

raju said...

very nice blogger thanks for sharing......!!!
poland web hosting
russian federation web hosting
slovakia web hosting
spain web hosting
suriname
syria web hosting
united kingdom
united kingdom shared web hosting
zambia web hosting

raju said...

awesome .......!!
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
panama web hosting
syria hosting
services hosting
afghanistan shared web hosting
andorra web hosting
belarus web hosting
brunei darussalam hosting

sugan said...

nice information......
apache solr resume sample
apache spark sample resume
application developer resume samples
application support engineer resume sample
asp dotnet mvc developer resume
asp net core developer resume
asp net developer resume samples
assistant accountant cv sample
assistant accountant resume
assistant accountant resume sample

divya said...

After reading your blog, I was quite interested to learn more about this topic. Thanks.thanks
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai

nisharoshan said...

Thank you for the informative post. It was thoroughly helpful to me. Keep posting more such articles and enlighten us.

Web Designing Training Course in Chennai | Certification | Online Training Course | Web Designing Training Course in Bangalore | Certification | Online Training Course | Web Designing Training Course in Hyderabad | Certification | Online Training Course | Web Designing Training Course in Coimbatore | Certification | Online Training Course | Web Designing Training Course in Online | Certification | Online Training Course

Anonymous said...

Thanks for provide great informatic and looking beautiful blog
python training in bangalore | python online Training
artificial intelligence training in bangalore | artificial intelligence online training
machine learning training in bangalore | machine learning online training
uipath-training-in-bangalore | uipath online training
blockchain training in bangalore | blockchain online training
aws training in Bangalore | aws online training
data science training in bangalore | data science online training

Tableau Training in Hyderabad said...


Nice article and thanks for sharing with us. Its very informative




Machine Learning Training in Hyderabad

Post a Comment