Go Down

Topic: Wired/Wireless Hardware Advice (Read 968 times) previous topic - next topic

stargazing

Hi, looking for some hardware advice on a system I'm trying to design.

System can have up to 20 slaves and one master.

Slaves will use ATmega32u4 (Leonardo) on custom PCB allowing more options.

Master could be any Arduino or Raspberry Pi.

Slaves can be connected wired or wireless, could be 4 wired and 8 wireless as an example.

Hardware hot swappable.

Coverage for inside/outside of a typical home.

Ethernet cables for wired.

Lots of data to send between master/slave, up to 64 bytes without formatting or checksum.

Like to update data on master every second.

Want to keep cost of wireless under $5 per device.

Skills/experience, low to moderate.

I have experience with I2C and ruled it out.

I like Serial because no libraries, with checksum plenty reliable for this application. I can use deviceIDs to sort things out if Serial is a good option? HC-12 looks perfect for wireless range which would also tie right in.

I'm guessing most think RS-485 or CAN-Bus for wired is best? I love sound of CAN but message length is only 8 bytes. Also maybe too complex for me, is RS-485 easier to manage? Don't really like to rely on other libraries.

My biggest questions is with wireless, I've looked at videos with the most common modules and the HC-12 sticks out as the best for me but have a feeling it might not be good for a large system. What would you recommend for this? Thanks.

TomGeorge

#1
Nov 17, 2019, 03:54 am Last Edit: Nov 17, 2019, 03:56 am by TomGeorge
Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .

Why do you need updates every second?
Is this for a home monitoring system?
Google

nrf2401 arduino mesh

You will find their application my be exactly what you are looking for...

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

mikb55

#2
Nov 17, 2019, 09:04 am Last Edit: Nov 17, 2019, 11:26 am by mikb55
For the wired option that doesn't use a library...

- If you go with a bus then you will end up re-inventing Modbus or CAN bus. Do you really want to go down that road?

- If you go with star wiring, that is lots of cable which could end up being expensive and inflexible.

Both options will require differential drivers to give sufficient noise immunity over long cables.

There are multiple ways of working around message size limitations. In reality almost all measurement and command data can fit into 8 bytes. If you want to send long plain text diagnostic messages then you can assign a bank of n message IDs giving you the ability to send n * 8 characters.

Paul__B

You can use nrf2401s - I really have no experience with these.

Whenever I see WiFi mentioned, my advice is to swap to - not add - an ESP8266 so you only need the one processor.  If you only need a couple of (four) control pins, then ESP-01s or if more, the WeMOS D1 Mini.  These can if you feel the need, be mounted to your custom PCB.

stargazing

Hi, thanks for the replies, didn't think anyone did as no email. Sorry if I broke a rule.

Tom that nRF24L01 does look promising, thanks!

It's basically a customizable home monitoring/control system that's why I want to update every second, after that it feels like your waiting. Some of the devices could have up to 8 DHT22's connected so that's 16 floats to send to master, don't think that can be crammed into 8 bytes. :)

Definitely don't want to be reinventing any wheels, after looking more into RS485 I'm a little intimidated as that's what your basically doing. Apparently not as easy as one might seem to not have collisions, I think over my head with so many devices.

With current skill set I think I'm stuck to Can-bus as the controller does it all but I'm limited to what the library can do as the protocol is over my head, maybe I will forget wired altogether.

Didn't consider the ESP8266, I suppose that would work but I'm guessing code would be complicated with so many devices?

Robin2

This Simple nRF24L01+ Tutorial may help.

However the OP has not told us what wireless range is required or whether the wireless signal must penetrate walls. The lower frequency HC12 will have longer range and more penetration, but I have never used them.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Paul__B

Some of the devices could have up to 8 DHT22's connected so that's 16 floats to send to master, don't think that can be crammed into 8 bytes.
Didn't realise that a DHT22 generated data as floats!  :smiley-eek:

Definitely don't want to be reinventing any wheels, after looking more into RS485 I'm a little intimidated as that's what your basically doing. Apparently not as easy as one might seem to not have collisions, I think over my head with so many devices.
Collisions do not happen in this context.  The master polls each slave, one by one.  :smiley-roll:

Didn't consider the ESP8266, I suppose that would work but I'm guessing code would be complicated with so many devices?
Code is always going to be complicated.  :smiley-lol:

That's why you use libraries.

SteveMann

#7
Nov 18, 2019, 04:26 pm Last Edit: Nov 18, 2019, 04:30 pm by SteveMann
Hi, thanks for the replies, didn't think anyone did as no email. Sorry if I broke a rule.

Tom that nRF24L01 does look promising, thanks!

It's basically a customizable home monitoring/control system that's why I want to update every second, after that it feels like your waiting. Some of the devices could have up to 8 DHT22's connected so that's 16 floats to send to master, don't think that can be crammed into 8 bytes. :)

Definitely don't want to be reinventing any wheels, after looking more into RS485 I'm a little intimidated as that's what your basically doing. Apparently not as easy as one might seem to not have collisions, I think over my head with so many devices.

With current skill set I think I'm stuck to Can-bus as the controller does it all but I'm limited to what the library can do as the protocol is over my head, maybe I will forget wired altogether.

Didn't consider the ESP8266, I suppose that would work but I'm guessing code would be complicated with so many devices?
Yes. You are reinventing the wheel.  Many, many times over.  If you follow your one-off, nobody's ever done anything like this before approach, you have a difficult to update or expand system, and few people will be able to help you.

Research assignment for you: MQTT, Wemos D1 Mini, Home Assistant, Node Red.

Your project description is not a project description at all.  It's a list of hardware and protocols that you plan to use, but you barely explain what our project goals are.  It's like deciding on the engine before looking at the car.

Tell us what you want to do , not how you want to do it, and then you may get better responses.

stargazing

This Simple nRF24L01+ Tutorial may help.

However the OP has not told us what wireless range is required or whether the wireless signal must penetrate walls. The lower frequency HC12 will have longer range and more penetration, but I have never used them.

...R
When Tom recommended, your thread was the first I found, just reading the headings got me excited as everything is built in, seems close to a Can-bus.

The wireless range is hard to put a number on it, basically around the average home so yeah walls to deal with. I'm pretty sure the onboard antenna will be useless but see some with external antennas so maybe, going to order a few and see how they perform.

Are you happy with long term reliability on the nRF24L01+? (I'm aware the + is an upgrade).

Didn't realise that a DHT22 generated data as floats!  :smiley-eek:
I have special DHT22's.  :P

Collisions do not happen in this context.  The master polls each slave, one by one.  :smiley-roll:
Yeah but I need more than that, some slaves will randomly send out a message to master so timing is important as master could be busy sending a request. Apparently that's not easy to deal with using RS485.

Yes. You are reinventing the wheel.  Many, many times over.  If you follow your one-off, nobody's ever done anything like this before approach, you have a difficult to update or expand system, and few people will be able to help you.

Research assignment for you: MQTT, Wemos D1 Mini, Home Assistant, Node Red.

Your project description is not a project description at all.  It's a list of hardware and protocols that you plan to use, but you barely explain what our project goals are.  It's like deciding on the engine before looking at the car.

Tell us what you want to do , not how you want to do it, and then you may get better responses.
I'm not going for a one-off approach, I'm looking for something I can actually work with and finish the project, once finished no need to expand as that's part of the system. I don't really have a project description at this time, I'm trying to come up with a hardware structure that will fix many projects in the future. Once I have an infrastructure I can tune for the project. I know my projects will require modules so until I get a good communication system setup no use building the project. I don't agree with your engine analogy, many engines are used in the same car and was built before the car was ever designed.  ;) Thanks for the research assignment.

Robin2

Are you happy with long term reliability on the nRF24L01+? (I'm aware the + is an upgrade).
I never used the version prior to the +

I don't have any long-running application but I am not aware of any problems. They work every time I want them to.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Idahowalker

#10
Nov 19, 2019, 12:29 am Last Edit: Nov 19, 2019, 12:40 am by Idahowalker
I'm guessing most think RS-485 or CAN-Bus for wired is best? I love sound of CAN but message length is only 8 bytes.
A CAN buss message (ESP32 CAN library) looks like this:
Code: [Select]

  if (!PassTwo)
        {
          rx_frame.FIR.B.FF = CAN_frame_std;
          rx_frame.MsgID = 1;
          rx_frame.FIR.B.DLC = 8;
          rx_frame.data.u8[0] = *item & 0xFF;
          rx_frame.data.u8[1] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[2] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[3] = (*item >> 24) & 0xFF;
          PassTwo = true;
        } else {
          rx_frame.data.u8[4] = *item & 0xFF;;
          rx_frame.data.u8[5] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[6] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[7] = (*item >> 24) & 0xFF;
          ESP32Can.CANWriteFrame(&rx_frame); // send items over CAN buss
          PassTwo = false;
        }

That's 64bits per CAN message without using the extra space provided with an extended header. I use message ID to let the CAN receiver know what to do with the message. The ESP32 CAN library uses freeRTOS queues and background receiving/sending. I, typically, set a queue size level of 5 and the task, this code is from, is triggered as fast as a TFMiniPlus can take a reading.

Paul__B

Yeah but I need more than that, some slaves will randomly send out a message to master so timing is important as master could be busy sending a request. Apparently that's not easy to deal with using RS485.
Well, don't allow them to!

(How obvious is that?  :smiley-eek: )

stargazing

A CAN buss message (ESP32 CAN library) looks like this:
Code: [Select]

  if (!PassTwo)
        {
          rx_frame.FIR.B.FF = CAN_frame_std;
          rx_frame.MsgID = 1;
          rx_frame.FIR.B.DLC = 8;
          rx_frame.data.u8[0] = *item & 0xFF;
          rx_frame.data.u8[1] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[2] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[3] = (*item >> 24) & 0xFF;
          PassTwo = true;
        } else {
          rx_frame.data.u8[4] = *item & 0xFF;;
          rx_frame.data.u8[5] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[6] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[7] = (*item >> 24) & 0xFF;
          ESP32Can.CANWriteFrame(&rx_frame); // send items over CAN buss
          PassTwo = false;
        }

That's 64bits per CAN message without using the extra space provided with an extended header. I use message ID to let the CAN receiver know what to do with the message. The ESP32 CAN library uses freeRTOS queues and background receiving/sending. I, typically, set a queue size level of 5 and the task, this code is from, is triggered as fast as a TFMiniPlus can take a reading.
Thanks for that, I will look into it.

Well, don't allow them to!

(How obvious is that?  :smiley-eek: )
In a perfect world but look around.

Go Up