How to serial read hundreds of sensors ?

  • 22 Replies
  • 7455 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
  • *
  • 1729
    • 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
  • *
  • 1729
    • 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
  • *
  • 1729
    • 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 ?

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 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

Users Online

437 Guests, 0 Users

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

Articles