Modular Connections

Im trying to think of a way to have a modular detection of connected sub circuits. Say I have my main brains that can relay this information else where. and its has a couple of entry connections or attachment points. I could attach parts that would relay to the brains what part was connected and if it had more connection points collect what is attached at those points and so on.

let use the example of a modular firearm platform. the lower receiver would be the main controller.
maybe a struct like this when nothing attached

Note: just a simplified representation

struct Receiver {
    upper: null
    grip: null
}

then we attach an upper receiver

struct Receiver {
    upper: struct Upper {
        rail_slot_1: null
        rail_slot_2: null
        rail_slot_3: null
        hand_guard: null
        stock: null
    }
    grip: null
}

the upper receiver would then have extra connections for parts that it would collect information about and relay to the main controller.

so at any connection could either be a simple item connected with information of the item its self. or a relay with more connection points.

I was thinking using i2c to allow defining physical locating of the connected sub modules. that would work if I wanted to then maybe use one wire or CAN bus to then detect and get information of the connected device.

the circuit lay out would be like

(child coms) = one wire / CAN bus

Main Board => Root I2C Bus
    0x00 = attiny I2C slave (upper receiver) => child coms
        0x00 = attiny I2C slave (rail_slot_1) => child coms
        0x01 = attiny I2C slave (rail_slot_2) => child coms
        0x02 = attiny I2C slave (rail_slot_3) => child coms => scope
        0x03 = attiny I2C slave (hand_guard) => child coms
             0x00 = attiny I2C slave (rail_slot_top_1) => child coms
             0x01 = attiny I2C slave (rail_slot_top_2) => child coms
             0x02 = attiny I2C slave (rail_slot_top_3) => child coms
             0x03 = attiny I2C slave (rail_slot_top_4) => child coms

             0x04 = attiny I2C slave (rail_slot_right_1) => child coms
             0x05 = attiny I2C slave (rail_slot_right_2) => child coms
             0x06 = attiny I2C slave (rail_slot_right_3) => child coms
             0x07 = attiny I2C slave (rail_slot_right_4) => child coms

             0x08 = attiny I2C slave (rail_slot_bottom_1) => child coms => vertical_grip
             0x09 = attiny I2C slave (rail_slot_bottom_2) => child coms 
             0x10 = attiny I2C slave (rail_slot_bottom_3) => child coms => bipod
             0x11 = attiny I2C slave (rail_slot_bottom_4) => child coms

             0x12 = attiny I2C slave (rail_slot_left_1) => child coms
             0x13 = attiny I2C slave (rail_slot_left_2) => child coms
             0x14 = attiny I2C slave (rail_slot_left_3) => child coms
             0x15 = attiny I2C slave (rail_slot_left_4) => child coms
        0x04 = attiny I2C slave (stock) => child coms => long_stock
    0x01 = attiny I2C slave (grip) => child coms => sniper_grip
    0x02 = attiny I2C slave (magazine) => child coms => 5_round_mag

also child communication would need to be hot swapable. this shouldn't be much of an issue though and could even simplify detecting what type of item (simple / relay) is connected using a fourth connection that is a resistance between VCC.

is this a good solution for this idea or might there be a better way for this kind of modularity?

Try sticking to electronics and a block diagram of your project.
Unless you have electronics attached to anything, you will not be able to do what you propose.
And what they are stuck to does not matter. You do need a SOLID electrical connection.
Paul

yes but certain serial connections can be hot swapable. I was just revising the original question to point that out. this swapability was going to be between each I2C slave and their child coms through maybe a detection pin that would have a resistor across VCC and said pin. this could also be used to determine the type of item connected weather its an item that just returns a UUID or a attachment relay with child connections.

I guess your program could continuously poll the possible I2C addresses and get data from the latest one to appear.
Paul

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.