Hi, just trying to create a five scale system that i can view on a web interface, I’m new to this area. I jotted down some ideas of what I’m proposing, with a few questions, to layout what I’m creating. Thank you for all help.
I don’t know enough about RPi to help here but the statement
“I want the system to be cheap, whilst being reliable”
I have found over the years that mostly “cheap” and “reliable” rarely go together.
I agree that is not always the case and if you are careful this may not apply to your venture. If you can keep it simple your reliability chances will improve. I am not trying to kill off your venture but give you something to think about and there is no reason you can’t make this robust enough to get maximum performance. If you are keen on that “reliable” part don’t use that “830 tie point breadboard” in the final build. OK for experiment and development though.
Sounds like a cool project @Ashton244235
I found a similar project that you may be interested in. It looks like Design 1 will be viable - where you might be able to connect 5 Load Cell ADCs directly to the Pi.
Design 2 seems a bit fraught to me - having to maintain 6 devices running code separately sounds like a debugging R&D nightmare.
In contrast to @Michael I prefer Design 2. To interconnect the Pi Pico and Pi Zero use the I2C bus - this is designed for just this sort of interconnect. I am a fan of “divide and conquer”. Once the software of the Pico is sorted, it can be duplicated in the basic model without headers (the cheapest) and not changed. This just leaves programming the Pi zero.
If you haven’t a clue then there’s some learning to do. For testing I would not use a battery supply. Get a suitable mains supply then you won’t run into power supply problems (which can create all sorts of interesting problems). Get to know how to interface one pico with the load cell. As a separate exercise get to know how to interface pico and zero using I2C. Then try and combine both. Then figure out how to run the zero to get what you want. The best way to attack a complex problem is to break it down into smaller simpler bits, design and test each bit, connect the bits.
In my opinion, design for the pico/cell to be interchangeable - the pico stores the calibration data for its cell. The actual calibration calculations can be done elsewhere, all that is needed is the zero to be able to send the results of the calculation to the pico for storage. This means the conversation between pico and zero is a bit more complex than “give me a reading”. There will also be a “store this calibration” message.
An interesting challenge.
The bit that is missing from your description is the distance between the sensors and the Pi, and the environment they will need to operate in. These factors will have a big impact on the communication link that will work best.
TTL as in the first example has a usable distance that varies significantly according to the transmission speed and the noise in the environment, but is not typically used over more than a few meters. I2C, which is the obvious wired choice in the second example, should not be used over more than about a meter. USB is a bit like TTL - very dependant on how noisy the environment is, although high quality cables are available. About 15M is the usual maximum, but extenders are available. RS232, RS485 and current loop are other wired options that are typically used for longer distances.
For wireless, WiFi is usable over longer distances but walls and other radio devices can reduce this range; repeaters are available. Zigbee is an example of a different wireless option. It is designed for distances up to about 100M, and is particularly well suited to a mesh arrangement such as you are planning.
Ok, thanks; it is a challenge. I have a load cell and Pico working, and I am viewing data on my laptop in Thonny. Have you got any useful links or videos for interfacing the Pico with the Zero via I2C to read the load cell data? I like the idea of each Pico handling the calibration data, and then the zero just logging the data so it can be used from there.
They will operate indoors; they will be within a metre of the Pi Zero.
What is the best option for wired communication, keeping it simple (USB?)?
I’m not sure about the wireless side of communication; have you got any useful resources that could show how to send data wirelessly from the Pi Pico W to the Pi Zero W? In case I decide to go down that pathway.
Do I have to buy any additional components for wireless transmission (Zigbee)?
Thank you. Do you have any clue how I would go about wiring four HX710B’s to the Raspberry Pi W (going of the pin diagram numbers)?
I think you have caught me out. I did some research and there are a few people who post solutions for the pico as an I2C slave but none of them seem straightforward. Which seems a bit odd as it is the logical way of using the technology.
If it were me, I’d be writing a small program in C for the pico, running the hardware directly. I’ve never done it but I’m a long time programmer so my learning curve wouldn’t be too steep. However it isn’t a solution for you who have little experience in that area. And if someone did it for you, it may be difficult for you to maintain/modify the code.
That leaves Solution 1 as a possibility. There are sufficient GPIO pins on the Pi to run each load cell on its own pair of wires. So from a hardware point of view it looks feasible but the tricky point is the programming (again). Not sure how you deal with that hurdle.
In that case you have a wide choice for communication options. I2C would be the simplest option: a metre is beyond the usual practice for the technology, but it would work OK if care is taken with cabling and termination, and the environment is not electrically noisy. Otherwise, TTL UART would be quite practical if the Pi can support that many serial devices - it has the CPU power to do it but I’m not sure it has ever actually been done.
For that distance wireless could not be justified.
As Jeff mentioned, a bus-based protocol would be easiest (you don’t need tons of interfaces on the Pi, just one), Modbus is well documented and can work on RS232 for medium lengths, and RS485 for longer lengths. I have 4 temperature sensors hooked up to a Pi via Modbus and maybe 50m of combined wiring. Just another avenue to look down. How fast do they all need to update?
Also, not to rain on your parade, but is there a reason why 5 benchtop scales side by side wouldn’t work?
Take a look at the python file in the repo i linked - the pins are defined as follows using
CLCK_# where each is assigned GPIO number
GAIN = 64 DATA_1 = 20 # connect GPIO 20 to the data signal of an ADC CLCK_1 = 21 hx1 = HX711(DATA_1, CLCK_1, gain=GAIN) DATA_2 = 19 CLCK_2 = 26 hx2 = HX711(DATA_2, CLCK_2, gain=GAIN) DATA_3 = 6 CLCK_3 = 13 hx3 = HX711(DATA_3, CLCK_3, gain=GAIN) DATA_4 = 12 CLCK_4 = 16 hx4 = HX711(DATA_4, CLCK_4, gain=GAIN)
Thank you that makes more sense, just had a chance to look at. Dose The raspberry Pi Zero W work for this project or is the Pi Pico better (I need to host a web interface)? Also How do I wire the four wires for GND 1-4 and VCC 1-4 as shown in diagram? I think I get how to wire the DT and SCK for each using the code as reference you provided earlier. Thanks for all the help.
So that you can copy from the other project it would be better to go with a Zero W.
All of the VCC pins can go to 3v3 and all of the GND pins to any of the Pis GND.
Have you got any hardware to tinker with? Personally I find it much easier to visualise how everything ought to go together with the actual bits.
Ok so I just connect all the pins to one e.g. 4x VCC to the 3V3 right?
Hi Have already got the Pi Zero W
I Just need to buy the load cells and load cell amplifiers. Anything else you would buy?