BUS over one (fiber optic) wire

Hello,

I am working on an ambition project (in the context of my experience). I have done a lot of research and I can see various ways I can achieve what I want. I would like to ask for your opinion regarding what path is most likely to achieve success.

I have a lot of programming experience, but limited experience with Arduino and hardware interaction.

End goal
The end goal is to collect information from a network of small devices (preferably digysparks because I already bought hundreds of them).

Requirements

  • One master should be able to collect information from around 50 slaves
  • One wire only for data transmission (3 wires including power and ground)

Other considerations

  • Ultimately I will have about over 300 hundred data sources, but I don’t mind having multiple masters collecting the data from all.
  • I want to use fiber optic wire for data transmission
  • I like the idea of using one digital pin for each slave - this way I don’t have to program IDs into the slaves if I need to replace one

What have I tried

  • I2C. I ran into issues when one slave has problems. Also it needs two wires and hard to replace the wires with fiber.
  • Attempted to create my own communication protocol via digital pins by sending short bursts of power and read them as binary. Reading the length of the pulses seems quite inacurrate, and scaling up to 50 slaves makes the data quite unreliable, or slow.

My next attempt
What I am trying now is to use serial communication. Master would TX via the wire a device ID, then switch the wire to RX. The slave who identifies with that ID would switch to TX, send the data and switch back to RX. Based on my research this seems to work. The downside is that the slaves need pre-programmed IDs

Wishful thinking
I could easily achieve all my requirements if I could reliably send one way data via digital pins. Before making things more complicated than I should, can you tell me if this is achievable?

Thanks,
Andi

You are trying to design a Mesh Network, where there's a single master and multiple slaves. I think here Serial Communication will be the best option.

If you want to make the system simple then no need of ID. Instead send some specific character before each node i.e. A(Data sent) for node 1 and B(Data Sent) for node 2. Something like that.

Maybe a tree of identical nodes? You don't say what sensors you plan to use, so I'll assume one analog or digital pin per node, for the sensor. That leaves each digispark with 5 pins. One is used to relay it's sensor readings to a "parent" node. The other 4 can be connected to "child" nodes. Each node periodically sends it's sensor reading to its parent node. The rest of the time, it listens for messages from its child nodes. When it receives one, it labels the message with whichever child pin it was received from, and then forwards it to its parent node.

Might be worth looking at PJON.

If you want to distinguish signal sources, each node must have assigned a fixed and known ID.

Hello everyone. Thank you very much for your input. It is communities like these that assures a better, global future.

@jackthomson42

  • Indeed Serial is my next attempt. Happy that you find it feasible
  • All the slave devices will send data at the same time over the same wire. They need IDs because they need to send data when requested. Otherwise all of them send at the same time so I'll probably receive corrupted data.

@PaulRB

  • I believe a three would add extra complexity, with the only gain of increasing the device limit. I am planning that anyway, but for now I want to do a proof of concept with one master and 50 slaves. In the end I will have 6 masters, with a total of 300 slaves and those masters will send data to a computer. But that for the future. For now a simple system of one master (Mega) and 50 slaves (DigiSparks) is good enough. Scaling up from there should be fairly easy
  • Each DigiSpark will use indeed one analog pin to read sensor data. The type of sensors varies (temperature, switches, distance, etc.).

@Riva

  • I am super super excited about PJON. I've been reading about it the past few hours. It's very likely to be my solution.

@DrDiettrich

  • Indeed. Otherwise I cannot request data from specific slave so then they would all broadcast at the same time mixing their signals.

For everyone

  • Do you know any good implementation of reliable communication between two Arduinos via digital pins? Mega has over 50 digital pins so if I could use those to communicate to the DigiSparks everything is very simple from that point.

Thank you,
Andi

Why do you want to use a Mega? With a dedicated signal line to each slave, or why else? I don't think that a Mega can support 50 slaves sending on 50 lines at the same time.

Also hardware for 50 channels over a single fiber will be quite bulky and expensive. Also dunno how 50 slaves connect to a single fiber at all.

Hello,

@DrDiettrich - The advantage of of using dedicated single line and dedicated pin for each slave is that I don't have to give them an ID - meaning that I can replace them without programming them.

@Riva - PJON seems to be exactly what I need. I've been experimenting with it a lot and it's prefect.

The only challenge is that it seems I cannot get it running on DigiSpark devices. I have a hint why it wouldn't work and I opened a new thread about that ( DigiSpark External Oscillator - Microcontrollers - Arduino Forum ).

Can anyone else think of any other reason why PJON SoftwareBitBang won't work on a DigiSpark?

Thank you,
Andi Stancu

andistancu:
The only challenge is that it seems I cannot get it running on DigiSpark devices. I have a hint why it wouldn't work and I opened a new thread about that ( DigiSpark External Oscillator - Microcontrollers - Arduino Forum ).

Can anyone else think of any other reason why PJON SoftwareBitBang won't work on a DigiSpark?

The PJON site site mentions the ATtiny85 (Digispark development board) 16MHz as being compatible so I think you may be better contacting them for support.