How to serial read hundreds of sensors ?

  • 22 Replies
  • 6621 Views
*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
How to serial read hundreds of sensors ?
« on: November 27, 2017, 10:02:09 pm »
Arduino Uno buffer is limited to 255 characters (may be I am wrong just tell me).
If I want to read hundreds of sensors, how to bypass this ?
Arduino mega is better but I guess not enough ?
Or may be to place a Raspberry with a shield or HAT ?
Or the only way is to add arduinos ?

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: How to serial read hundreds of sensors ?
« Reply #1 on: November 27, 2017, 11:24:30 pm »
I don’t have any experience with the Arduino but in most language read/ write scenarios the buffer is just the maximum sized block of data that the read/ write functions can handle at once.

So you can fill any size memory array you like but only 255 characters can be passed/ read/ written at once for each function call. 

So 3000 characters is going to be 3000 / 256 =11.7 or a loop that cycles 12 times, calling the read/ write functions.

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #2 on: November 27, 2017, 11:35:35 pm »
yes I know... Actually I m wondering about the most efficient way to solve this issue...

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: How to serial read hundreds of sensors ?
« Reply #3 on: November 27, 2017, 11:57:21 pm »
Were are you getting the data stream from? Another computer or an external add-on of some type?
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: How to serial read hundreds of sensors ?
« Reply #4 on: November 28, 2017, 12:12:17 am »
 I was thinking about using
a external data bus and a external addressing bus. But a hundred addressing chips, and more, for each sensor
location? That is spread out on a one meter, spinal, addressing and data buss. That can add allot
of weigh,t and get kind of expensive, and bulk for small robot. 

  But i am going with something completely different, that I will be developing over the next few years or  more. And that is to
have a long loop of parallel wires that have a positive and a ground and third sensing wire.
 These wires run in parallel. There will be hundreds of sensors chip on the loop of wires.
 But they will be powered in a very weird way. A sort positive pulse is sent in on the right side and ground pulse is sent in on the left side.
 Where two pulse meat  they will power that sensor for a short time. A third sensor wire, that is connected to all sensor on
the loop, that well be read by the Raspberry. This is a analog read so a analog to digital chip may be needed,
  A Arduino may have one built in?
 For selecting a sensor chips on loop you need carefully timed pulses. which i believe the Raspberry can do with a gigahertz clock and extra
external circuits.





*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #5 on: November 28, 2017, 09:42:11 am »
Were are you getting the data stream from? Another computer or an external add-on of some type?

Sensor > arduino > Python (with pyserial module and serialread()) installed on a raspberry.
This is functioning perfectly as long as arduino string is shorter than 255 characters. But what if the string goes more than 255 characters ?

*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #6 on: November 28, 2017, 09:49:08 am »
I was thinking about using
a external data bus and a external addressing bus. But a hundred addressing chips, and more, for each sensor
location? That is spread out on a one meter, spinal, addressing and data buss. That can add allot
of weigh,t and get kind of expensive, and bulk for small robot. 

  But i am going with something completely different, that I will be developing over the next few years or  more. And that is to
have a long loop of parallel wires that have a positive and a ground and third sensing wire.
 These wires run in parallel. There will be hundreds of sensors chip on the loop of wires.
 But they will be powered in a very weird way. A sort positive pulse is sent in on the right side and ground pulse is sent in on the left side.
 Where two pulse meat  they will power that sensor for a short time. A third sensor wire, that is connected to all sensor on
the loop, that well be read by the Raspberry. This is a analog read so a analog to digital chip may be needed,
  A Arduino may have one built in?
 For selecting a sensor chips on loop you need carefully timed pulses. which i believe the Raspberry can do with a gigahertz clock and extra
external circuits.

1. I found a way to stack hundreds of servos with a single arduino. This is using I2C. https://learn.adafruit.com/adafruit-16-channel-pwm-slash-servo-shield/overview

2. Can we do this with sensors too ? I saw a sensor shield but I don't think it has I2C. So I cannot stack ? https://www.sainsmart.com/products/sensor-shield-v5-bluetooth-analog-input

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1722
    • mind-child
Re: How to serial read hundreds of sensors ?
« Reply #7 on: November 28, 2017, 11:35:09 am »
Why not reading it in a plain loop? In every step you can change an input range.

*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #8 on: November 28, 2017, 12:22:07 pm »
Why not reading it in a plain loop? In every step you can change an input range.

I don't get it. You talk about arduino or python ?

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1722
    • mind-child
Re: How to serial read hundreds of sensors ?
« Reply #9 on: November 28, 2017, 12:23:45 pm »
Why not reading it in a plain loop? In every step you can change an input range.

I don't get it. You talk about arduino or python ?
Arduino assembly or Python. Should work both ways.

*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #10 on: November 28, 2017, 12:33:42 pm »
Why not reading it in a plain loop? In every step you can change an input range.

I don't get it. You talk about arduino or python ?
Arduino assembly or Python. Should work both ways.

Everything is already in a loop (python and arduino) . What do you mean by "plain loop" and "input range" ? and what difference this would make ?

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1722
    • mind-child
Re: How to serial read hundreds of sensors ?
« Reply #11 on: November 28, 2017, 12:41:13 pm »
Why not reading it in a plain loop? In every step you can change an input range.

I don't get it. You talk about arduino or python ?
Arduino assembly or Python. Should work both ways.

Everything is already in a loop (python and arduino) . What do you mean by "plain loop" and "input range" ? and what difference this would make ?

Code
FOR i = 0 TO Sensors.length // loop through any number of sensors
    SET activeSensor = Sensors[i];
    SET data = activeSensor.read();
    doSomething(data);

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: How to serial read hundreds of sensors ?
« Reply #12 on: November 28, 2017, 01:49:43 pm »
 If you are going to hook up up a 1000 sensors to a computer you have a choice of 1000 wires to each sensor or one or two
16 bit buss that go to all of them.  This scales quite well.
 Or you can do a analog bus loop. which i am going with and it will scale quite well. But for drones and really small stuff
then a one wire to each device or sensor. And one ground to connect them all. 

But the problem with my way there is nothing on the marked that will do this.


 

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: How to serial read hundreds of sensors ?
« Reply #13 on: November 28, 2017, 02:13:15 pm »
System with thousands of Raspberry Pi nodes brings affordable testbed to supercomputing system: 

https://techxplore.com/news/2017-11-thousands-raspberry-pi-nodes-testbed.html


*

Thierry

  • Nomad
  • ***
  • 60
  • God is a sphere. Press 9 to enter.
Re: How to serial read hundreds of sensors ?
« Reply #14 on: November 28, 2017, 04:56:20 pm »
If you are going to hook up up a 1000 sensors to a computer you have a choice of 1000 wires to each sensor or one or two
16 bit buss that go to all of them.  This scales quite well.
 Or you can do a analog bus loop. which i am going with and it will scale quite well. But for drones and really small stuff
then a one wire to each device or sensor. And one ground to connect them all. 

But the problem with my way there is nothing on the marked that will do this.

Would you connect the bus directly to python ? No need of arduino anymore ?

 


Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 15, 2024, 08:14:02 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

268 Guests, 0 Users

Most Online Today: 320. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles