What is the right way to do serial port I/O?

Ah yes, I see what you mean. I never paid attention to the green mark until you mentioned it and you are correct, it has nothing to do with the original subject in the first place.

No, but it is Friday afternoon and about time for a cold beer! :slight_smile:

1 Like

Lots of good information in this thread!

Keith

First off, are you controlling the amount you inflate the life vest and the ascent rate so you don’t give the diver the bends or an embolism? Please tell me you won’t be testing this on human subjects. Do not under any circumstances test your senior design project on live subjects. I’m not joking here. Assuming the answer is no live subjects are involved, read on.

That pressure transducer (PT) looks fine. I’ve been making the assumption whatever you’re building will have a pressure housing with the PT threaded into a NPT (or similar) port on the inside drilled through to expose the PT to sea water. Is that what you have in mind?

Also, with a 4-20 mA sensor you don’t have to worry about a constant voltage supply. They work by modulating the current flowing in your loop so it is proportional to pressure independent of small variations in the voltage provided by the voltage supply or more likely batteries in your case. The voltage drop across the shunt resistor and into your ADC is equal the current (which should be somewhere between 4 and 20 mA) times the resistor value.

As for accuracy, here’s another wildly oversimplified description. You need to figure out what the reference voltage is on the ADC on the board you’re using. That will be the maximum voltage the ADC can measure. You also need to know if it is single ended (aka unipolar), i.e. measures voltages from 0 (ground) to the ref voltage or if is bipolar, i.e. measure voltages from -Vref to + Vref. If you have a 10 bit ADC and assuming it is a perfect no noise device (more on this later) it can resolve 2^10 = 1024 different voltages over the input voltage range. Assume that Vref is 1V. If it is setup as a unipolar device you can resolve 1V / 1024 = about .001 V. If you pick a 100 psi PT, it will put out 4 mA at 0 psi and 20 mA at 100 psi. 100 psi / 16 mA = 6.25 psi/mA. If you pick a shunt resistor of 50 ohms, 0 mA will give you 0V across your resistor and into your ADC, 20 mA will give you the full 1 V. So 20ma / 1v = 20 mA /V. Now 6.25 psi/mA * 20 mA/V * .001V resolution = .125 psi resolution.

However, nothing is perfect so you probably won’t get the full 10 bits of resolution. You can redo the calculations assuming you get 8 or 9 bits.

In addition, you have to make sure there is enough “compliance” in your loop. That is how to figure out how much voltage you need and whether the shunt resistor you pick will work. Unfortunately, it is too detailed a subject for here. Hopefully you can Google it and find out what you need.

If you want more resolution you can just oversample the ADC. That is why the LSB of these uControllers is always noisy. Many ADCs intentionally add dithering to enable you to do this.

No conspiracy theory here, I meant to +1 and accidentally unmarked an answer, so I marked the same post as the answer again.

(If memory serves correctly - that was a couple days ago).

I wish I could blame it on tequila …

2 Likes

This has happened to me more than once, esp when trying to +1 on the iPad.

Gene,

Thank you much for your detailed response! I really appreciate all the help.

The rate of ascent isn’t a problem because the “breath hold diver” inhales uncompressed air at the surface. The body and air will compress as the diver descends and decompress as they ascend but because they’re not inhaling compressed air at depth and then surfacing rapidly, they’re not at risk of popping a lung.

We will be testing the rig without the inflation device to make sure it works properly. Because it’s a senior design project I think we’ll skip human testing because that sounds dangerous.

The pressure sensor is intended to be attached to a pressure housing.

The design for the waterproof containers is sketchy at best. Ideally we would design and fabricate (3D printed or machined) a pressure housing. We need two: 1. contains the mainboard, batteries, maglatch valve and relay (to be worn on body) 2. contains the 16x2 backlit char display and two buttons (to be worn on the wrist.)

I’m thinking of using the RS232 module to interface with an ADC that outputs via RS232 Female to interface with a pressure sensor.

I thought I did … my bad.

mhectorgato both taketh and giveth points.

Will this thing work with a Cerberus? I couldn’t find anything on the page or the information about it that said “yeah, this stuff definitely works with .net gadgeteering items.” The spot where you hook the cable up has the same shape as the .net gadgeteering hardware.

http://www.robotshop.com/elexol-8-channel-analog-to-digital-i-o-board-4.html

What about this thing?

https://ssl.kundenserver.de/ssl.taskit.de/xtc/product_info.php?products_id=268&XTCsid=8b2f5556b8f747180b666ab7a542d5d8

I’ve noticed a good deal of what I find is just a chip that’s an ADC. I would like to avoid assembling them myself. What key words or tricky phrases should I include to get something that’s already set up?

Thank you for your time,
Keith

@ Keith_

It is better to start a new thread.

The device from the first link ( Elexol 8 ) uses SPI, so it will work with Cerberus for sure.

Second one is serial - RS232. You will need this module to make it work with Cerberus:
https://www.ghielectronics.com/catalog/product/355

I finally found the button to do so! Thank you much sir!