• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to use EMO-R8 directly ?

    Scheduled Pinned Locked Moved Unipi Extension Modules
    4 Posts 2 Posters 1.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      PythonRunner
      last edited by

      This post is deleted!
      P 1 Reply Last reply
      Reply Quote 0
      • P
        PythonRunner @PythonRunner
        last edited by

        ONLY in English ...

        Hello,

        I have a Unipi 1.1 card and an 8 relay extension EMO-R8.

        I can drive the Unipi card (I2C address 0x20).
        The EMO-R8 module is configured to I2C address 0x22.

        But unlike the relays on the Unipi board, I can't do anything with the EMO-R8 module.

        Nothing happens :(

        Here is my program which works perfectly with the Unipi 1.1 board:

        #!/usr/bin/python
        
        #
        # Testing relays
        #
        
        import smtplib
        import math
        import smbus
        import time
        
        # Open the bus
        bus = smbus.SMBus(1)
        
        # Force output ports
        bus.write_byte_data( 0x20, 0x00, 0x00 )
        
        wait5s=5
        wait=0.125
        
        # Activates relays and switches them off 
        for value in [0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80]:
            bus.write_byte_data( 0x20, 0x09, value )
            time.sleep( wait5s )
        
        # Activates relays and switches them off 
        for value in range(0,80):
            bus.write_byte_data( 0x20, 0x09, value )
            time.sleep( wait )
        
        # Activates relays and switches them off 
        for value in range(80,0, -1):
            bus.write_byte_data( 0x20, 0x09, value )
            time.sleep( wait )
        
        # Activates relays and switches them off 
        for value in [0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01]:
            bus.write_byte_data( 0x20, 0x09, value )
            time.sleep( wait )
        
        # Force ports to zero
        bus.write_byte_data( 0x20, 0x09, 0x00 )
        

        See the list of I2C addresses used :

        root@raspberrypi-002:/home/pi# i2cdetect -y 1
             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
        00:          -- -- -- -- -- -- -- -- -- -- -- -- --
        10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
        20: 20 -- 22 -- -- -- -- -- -- -- -- -- -- -- -- --
        30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
        60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- 6f
        70: -- -- -- -- -- -- -- --
        

        This gives in readable form :

        Chip 			Adress		Usage			Board
        -----------------------------------------------------
        DS2482-100		0x18		1Wire master	Unipi 1.1
        MCP23008		0x20		Relays			Unipi 1.1
        MCP23008		0x22		Relays			EMO-R8
        24AA00/24C02	0x50-0x57	EEPROM			Unipi 1.1
        MCP79410		0x57,0x6F	Real time clock	Unipi 1.1
        MCP3422			0x68		ADC				Unipi 1.1
        
        root@raspberrypi-002:/home/pi/unipi# i2cdetect -l
        i2c-1   i2c             bcm2835 (i2c@7e804000)                  I2C adapter
        

        When I operate the Unipi relay ports :

        I have activated the MCP23008 (on the Unipi 1.1):

        It works perfectly :)

        Initialisation of port 0x20 (Unipi 1.1) :

        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x20 0x00 0x00
        
        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x20 0x09 0x01
        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x20 0x09 0x00
        

        How to use port 0x22 (EMO-R8) ?

        Because the following does not work :(

        Initialization of port 0x22 :

        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x22 0x00 0x00
        
        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x22 0x09 0x01
        root@raspberrypi-002:/home/pi/unipi# i2cset -y 1 0x22 0x09 0x00
        

        Do I need to do anything special to make the EMO-R8 modules work ?

        I know, that there are Unipi solutions via their programs. But, I want to be free and not use a program that will have difficulty interfacing with other programs specific to my needs.

        That's why I prefer to access the controllers directly and do exactly what I want.

        Thank you for your help :)

        JB

        1 Reply Last reply
        Reply Quote 0
        • M
          martin_triska
          last edited by

          Hello @PythonRunner ,

          it seems weird. There should be no traps - just one MCP23008 in the "typical" schematic.

          Do you have a power supply for the EMO board strong enough?

          Have you checked the functionality even with the Unipi software (e.g. Evok)?

          P 1 Reply Last reply
          Reply Quote 0
          • P
            PythonRunner @martin_triska
            last edited by

            @martin_triska Thank you for this answer :)

            As you can see the addresses of both MCP23008 are visible.

            0x20 for the MCP23008 on the Unipi 1.1 board
            0x22 for the MCP23008 of the EMO-R8 expansion board

            And both boards have their own power supplies purchased from Unipi (CLW-1005-W2E-EB) of 5V in 2A.

            And with or without, it doesn't matter...

            So I made a new RJ11 cable and it worked :)

            Life is simple especially with a good connection....

            1 Reply Last reply
            Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post