Posts: 3
Joined: Thu Dec 13, 2018 2:44 am

High voltage device with R-Pi brain

Thu Dec 13, 2018 3:53 am

Hi all,

I'm relatively new with R-Pis and have a few questions about a device I'm trying to make: it's a device for surveying groundwater and I'm aiming to make it and test it so it will be freely available to communities in developing countries.

The aim:
- Input high voltage (24, 300 and 600 Vpeak square wave AC) into the groud via electrodes
- Have the Pi select which 2 electrodes are used via demultiplexers and bank of relays
- Take voltage measurements via other pairs of electrodes, again selected by Pi via deulitplexers and bank of relays (expected to be 10 mV to 10 V)
- At the same time as each voltage measurement is take, take a measurment of the supply current (expected to be 100 - 500 mA)
- Automatically cycle through a whole lot of combinations of electrodes (there will be 8 in the ground for intial prototype, many more in future)

There will be a number of modules I need to design:
- Supply module
- Electrode switching module
- Voltage measurement module
- Current measuremnt module
- R Pi

1. Supply module:
- 2 x GPIOs to control 2 x NPN trasistors which in turn switch 4 x reed relays essentially creating a DPDT switch which oscillates at whatever frequency is dictated by the GPIOs
- Relays to have diode protection on coil, GPIO to have 1k series resistor on input to transistor
- Q1a) Does this setup make sense to create a squarewave source from a DC input? Is there a much better way to achieve this? The DC input will be rectified and smoothed AC for the higher voltage version.
- Q1b) If I go with this current set-up do I need to add any other componenets to make sure the Pi doesn't fry? I've prototyped is and it works with 5 Vdc input but I've not tried 24 V yet.

2. Electrode switching module
- This will use a lot of GPIOs to control 4 separate demultiplexers (2 for supply and 2 for voltage measurements). The output of each deMUX will trigger a reed relay, in turn connecting a specific electrode to the right place.
- I plan to connect the GPIOs direct to the deMUX address pins then connect the output pins of the deMUX direct to the relay coils. I will use CD74HC238EE4 deMUX and start with HE3621A0510 relays for prototyping.
- Q2a) Can I connect everything directly like this or do I need some additoinal protection?
- Q2b) I believe that the high voltage lines should be isolated but is there anything else I need to add to ensure no issues, especiallt in the relays.

3. Voltage measurement module
- I have an ADS1115 which I have recording voltage differences but only at very slow rate (15 ms/sample), it should be capable of 860 sps so I need some help working out how to get it running the way I need (I have made another post in the sensors section regading this)
- The ADS1115 has an onboard range selection but I will need to add an external range selection incase I would like measure above 5 V, ideally I would be able to measure right up to the high voltage supply value using my ADC.
- Q3a) Has anyone here used an ADS1115 and could assist with sample code or a nudge in the right direction to get it running properly.
- Q3b) Putting in a rage selection should be relatively simple I imagine, just a multiplexer and a bunch of highly accurate resistors. I'm not sure of the requirements for isolating this potentially high voltage input though, any design conideration appreciated.

4. Current measuremnt module
- This will feed into a single channel of the ADC I imagine but I really don't know how to implement this module, I know isolation of the high voltage will be an issue and there's potentially a lot of current going through this module
- Q4a) Unsure where to start here, pointers warmly welcomed

5. R Pi
- The code, I have written some basic code to make the switching module and the supply oscillator work if they're to be controllled by GPIOs as I've described. It's not glamorous but it'll get the job done for now.
- Q5a) code for data aquisition - best way to implement so the code can run a quickly as possible and store data in a sensible manner? This will be an ongoing work in progress
- I need to change the current direction to avoid polarisation so I'll probably aim for about 100 Hz if I can achieve sufficient sample speed from the ADC, I can take a couple of measurements per cycle and average them out to reduce noise.

Thanks to anyone that made it this far down my essay, I really appreciate any and all input, I want to get a prototype working ASAP but as an newby to electronics and Pis I would love some insight as to where the design may fail.

I can document what I'm planning and share with anyone that is keen to stay involved or more long-term input as things develop over the coming months. The main stumbling blocks for now are: low sample speed on ADS1115, no idea how to measure current on high voltage supply, unsure of what protection is needed so i don't fry the Pi or deMUXs and inefficient code but this will improve quickly when I have the hardware up and running (I have good support on the code side of things).


Return to “Other projects”