02-15-2023 08:34 PM - edited 02-15-2023 08:34 PM
I'm developing a project with a fuzzy controller that takes two inputs and controls some relays.
The problem is that the inputs of the controller are 2 I2C sensors. The 2 sensors need to be a few meters away from each other. So, the problem lies in extending the I2C bus.
At first I tried using one arduino nano with the LINX library and the 2 I2C connected to the arduino, but faced many problems with extending the I2C bus.
So I came up with a possible solution. I could use 2 raspberries, each one connected with an I2C sensor.
The main labVIEW VI will be operating on my main pc and the data will be transfered remotely from the raspberries.
The question is if I can send data via wifi from 2 seperate raspberries to my main pc?
On my VI I will open two seperate LINX instances each one linked with the appropriate raspberry. Can I do that?
Of course I could try it, but at the moment I have one raspberry, I cant afford buying one just to try and fail.
02-16-2023 01:05 AM - edited 02-16-2023 01:06 AM
A few points: The main problem with connecting Raspy’s trough WIFI is to get the WIFI setup at all. If you get it done on one you can do it on two too.
Raspis are currently almost impossible to get and if you can find a source they cost double to triple what they were 3 years ago.
Why not use two Arduino’s instead? You can get high end Arduino’s with WIFI for a fraction of what a Raspi currently costs.
02-16-2023 01:35 AM
Couple of thoughts (before I state my agreement with RolfK)
I2C can be run at different speeds to afford different distance capabilities. Can the devices communicate at slower configured speeds? Have you tried playing with different bus pullup values?
But to side with Rolf, USB extensions are cheap and can certainly run several meters. Another arduino is way cheaper than an additional PI.
Using a second PI is like using a sledge hammer when a handheld ball-peen is all that's needed. There are also I2C <-> USB bridge specific devices that may be more suitable to the task. Can you do multiple PIs communicating with a host PC app? Absolutely. Generally speaking, networks don't care. Your PC communicates with hundreds-to-thousands of internet connected systems every day you open your browser.
This sounds like a "use the right tool for the job" and using hobbyist toolkit and an entire multi-core Linux SBC as an embedded device solely as an I2C bridge is certainly a bad fit. That may mean looking outside the hobbyist NI platform and trying to integrate other hardware with LabVIEW but you're already looking for alternatives.
02-16-2023 07:57 AM
Thank you for the instant replies.
The thing is that I'm in a hurry to get the data. So I'm desperate for something that works properly.
About the I2C bus you mentioned, the modules that extend the bus range are not available in my region (more than a month of shipping time). I haven't found proper instructions on how to calculate the pull up resistors (currently I'm using 4.7K on both SDA and SCL) that extend the bus, and lastly don't know what wire to use. Any suggestions?
The sensors I use are the BH1750 I2C light sensors. The tech sheet is here.
I dont know it is possible to lower the speed, because I dont know what my default speed is on labVIEW, but if I could do it, the way is from baud rate override when opening a LINX device, right?
If you could read the specs of the sensor, what is a lower value than the default that I can use?
Back to the raspberries, I've seen footage of people not having any trouble setting them up. They initialize the device firmware with makerhub, then the device is showed when opening a new project with the IP. Isn't this the way it's done? Why you said it's hard to set it up?
Let's say I use another arduino I only have to open the device from LINX with the IP. Which option do I choose from the picture below?
As you can tell by now I'm not in the need of a beautiful solution, sloppy and messy is fine as long as it works.
So, what I'm thinking is to use the arduino via USB and one I2C very close and the onther I2C using ethernet or wifi with another microcontroller, let that be rasp, arduino or anything.
Thank you very much.
02-16-2023 08:01 AM
I dont know how to reply to many messages in one reply. The above message is the reply.