Simulating an I2C Humidity Sensor to test Code on Proteus

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I want to simulate a specific sensor that uses I2C. I found it on Proteus but it does not let me change it's readings to see how it works with a c program (using Atmel Studio) in the micro-controllers connected.

 

Also, how can I use two I2C sensors at the same time (HIH8121-021-001 and TC74). Because I only see one SCL and one SDA line in port B.

 

HIH8121-021-001: https://uk.farnell.com/honeywell...

TC74: https://uk.farnell.com/microchip...

 

I have attached my working code for this too incase anyone is curious/helps answer my question.

Attachment(s): 

Last Edited: Fri. Mar 25, 2022 - 11:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how can I use two I2C sensors at the same time

They are likely to have different addresses, so you talk to one with it's address then the other with it's address. Should be able to get up to 127 devices on one 2 wire bus.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

My question is how did my technician make a component that communicates using I2C and is able to change the temperature. I want to do the same to the humidity one too.

Also, how would I connect them up simultaneously. Both to SCL and SDA. and would I need extra pull up resistors.

 

Last Edited: Fri. Mar 25, 2022 - 01:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry I don't do Proteus.

 

The I2C or TWI bus only needs 1 set of resistors like you have shown above.

 

For the TC74

3.1.2 SMBUS/I2C SLAVE ADDRESS

The TC74 is internally programmed to have a default
SMBus/I
2C address value of 1001 101b. Seven other
addresses are available by custom order (contact
Microchip Technology Inc.

 

Still looking for the other one.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

boog123 wrote:
My question is how did my technician make a component that communicates using I2C and is able to change the temperature. I want to do the same to the humidity one too.

 

Dont ask us....Ask your technician!

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

He doesn't respond to my emails. I sent 3 so far lol

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyway the Honeywell "datasheet" seem to have a lot of sales fluff but no address that I can see. sad

 

THIS https://prod-edam.honeywell.com/... has a bit of technical stuff about the Honeywell sensor but it may be for a different version of the sensor (HumidIcon??).

 

2.1 Sensor Address

Each sensor is referenced on the bus by a seven bit slave
address. The default address is 0x27. Other available
addresses are: I2C Slave addresses from 0x00 to 0x7F. Please
contact Honeywell Customer Service with questions regarding
custom Slave addresses.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Fri. Mar 25, 2022 - 02:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

boog123 wrote:
how did my technician make a component that communicates using I2C and is able to change the temperature.

 

Proteus calls this concept an "Active Component". Pester YOUR technician as to how it works or if he doesn't want to give up his "Special Knowledge" just ask hum to make another..

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
Proteus calls this concept an "Active Component".

 

https://www.edaboard.com/threads...

 

So it looks like you need the "SDK". That post says you can only get this via NDA. Presumably your tech has also signed such an NDA? So he could probably tell you how to do it but then he'd have to kill you!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

boog123 wrote:

My question is how did my technician make a component that communicates using I2C and is able to change the temperature. I want to do the same to the humidity one too.

 

He didn't. The TC74 is a standard part in the Proteus library.

 

[E2A]

There are already some I2C humidity sensors in the Proteus library, why not prototype using one of those?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Fri. Mar 25, 2022 - 12:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Dont ask us....Ask your technician!
There’s sample simulation for that sensors look at Proteus sample simulation.
boog123 wrote:
He doesn't respond to my emails. I sent 3 so far lol
beware your alphabet e-mail server.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

Last Edited: Fri. Mar 25, 2022 - 12:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your I2C addresses are wrong.  According to the datasheet for TC74(section 3.1.2), the 7-bit SLA is 0x4d.  That makes the 8-bit addresses: 0x9A for I2C write and 0x9B for read.  The other sensor is I2C 7-bit SLA: 0x27. That makes the 8-bit addresses: 0x4E for I2C write and 0x4F for read.  The 7-bit SlaveAddress SLA is shifted left one bit and then bit 0 is 0 for write and 1 for read.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Simonetta wrote:

Your I2C addresses are wrong.  According to the datasheet for TC74(section 3.1.2), the 7-bit SLA is 0x4d.  That makes the 8-bit addresses: 0x9A for I2C write and 0x9B for read. 

 

The TC74 comes in lots of different flavours...

 

 

The OP says this...
Quote:
//This is the Default Address for the TC74A0-5.0VCT #define TC74_WR 0x90 //= 1001 000 in BIN = 90 in HEX.

 

...of course, they might not have the right flavour selected in the device properties.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
He didn't. The TC74 is a standard part in the Proteus library.

Does it allow adjustment of temperature during simulation ?