FaradayRF / Faraday-Software

Faraday node software
https://www.faradayrf.com
Other
48 stars 19 forks source link

Integrate useful Buoy sensors into Faraday. #260

Closed kb1lqd closed 6 years ago

kb1lqd commented 7 years ago

Purchase and/or design sensor board(s) that integrate into Faraday's ADC's or SPI/I2C interface for use on the Buoy mission. Educational documentation should be created at a system level to show how Faraday integrates with sensors.

High Level Plan

Plan 1

This keeps Faraday in a high use situation but low power setup. It utilizes Faraday as a "Smart Node".

Pro's

Con's

Plan 2

Pro's

Con's

Analog

Work Needed

Integrating I2C Sensors

https://learn.sparkfun.com/tutorials/i2c

Using the Faraday headers I'll need to wire out:

I'll also need to supply pull-up resistors.

image

image

I/O Pin - Bit Bang

Due to the need/want to avoid sharing the SPI/I2C port assigned to the SRAM IC (having to switch modes and that the SRAM is used for everything!) I'm going to have to use a GPIO and bit bang. Preferenble this GPIO will have interrupt capability to receive data from the slave(s) and the only externally available pin to do is is ANALOG 2! This pin has an interrupt capability and doesn't have an RC filter to remove!

image

I2C Bit- Banging Pinout

SDA = A2 = P2_5 SCL = D8 = P5_2

GND = GND Pin

Firmware - I2C

We need to:

Analog Voltage Sensing

Voltage Reference

https://github.com/FaradayRF/Faraday-Firmware/blob/master/Faraday_Init.c#L413 and https://github.com/FaradayRF/Faraday-Firmware/blob/master/Faraday_Init.c#L445 initialize Faraday to use the CC430 internal 2.5V reference for the ADC inputs.

Apendix

TM36 Remote Sensing Datasheet

image

image

image

image

JL-FS2 Wind Sensor

Barometric Pressure

We're going to need a protective case and PCB for this but NOT sealed.

image

Possible ranges only vary a few kPa so it might be useful to zoom and scale into those regions? image

image

I2C Hardware Support CC430

We will avoid using this functionality because the priority to share this port with the SPI SRAM is critical. Bit banging I2C or switching to RPi for ease of use OK.

The I2C pins routed to the header on Faraday are silkscreen with the SPI option of MOSI and MISO. Changing the configuration of the hardware support for those pins and using the 3 signals needed (SDA/SCL/GND)

We'll be using the USCIBx bus and need to enable I2C mode. USCI_Bx is IN USE for the SRAM in SPI mode so we'll need to share with the sensors._

image

Setup I2C Raspberry Pi

kb1lqc commented 7 years ago

Sounds good. You sure we want to create conditioning boards for 4-20mA or 0-5V? I take it this is the lesser of the evils for available sensor products that are mostly off the shelf?

kb1lqd commented 7 years ago

Well @kb1lqc I'd prefer 0-5V scaling to 0V to VREF as it's simpler. We could try to find all I2C sensors too but I'm a little worried on getting I2C going... just from a gotcha's and such standpoint.

kb1lqc commented 7 years ago

OK @kb1lqd, at what point does interfacing I2C just buy us a big bang for the buck? Adding on conditioning hardware is a tad much if there are better and more convenient options in I2C.

kb1lqd commented 7 years ago

OK well let me see what I can find.

kb1lqd commented 7 years ago

@kb1lqc I recall my largest concern about the I2C:

We'll be using the USCI_Bx bus and need to enable I2C mode. USCI_Bx is IN USE for the SRAM in SPI mode so we'll need to share with the sensors.

So we'll need to swap between SPI and I2C and while I2C is in use we can't use the SRAM.

kb1lqd commented 7 years ago

@kb1lqc Are we planned out enough here to pull the trigger on buying sensors?

kb1lqc commented 7 years ago

@kb1lqd what about the DS28E17 from Maxim IC for 1 wire to I2C? I bet there are breakout boards for this.

kb1lqc commented 7 years ago

Possibly useful cheap board for 1-wire to I2C: http://modtronix.com/im1wp-tbb.html more expensive: https://www.tindie.com/products/closedcube/ds2482-800-i2c-to-8-channel-1-wire-breakout-board/

kb1lqc commented 7 years ago

Also @kb1lqd these Blue Robotics cable penetrators look awesome!

http://bluerobotics.com/store/connectors/penetrator-10-25-a/ cable-penetrator-3-r2 pottedrender

kb1lqc commented 7 years ago

OK looking at the sensors I have a few comments @kb1lqd

kb1lqc commented 7 years ago

Overall I have some comments on general sensors

kb1lqc commented 7 years ago

@kb1lqd check out the NOAA buoys: http://tao.ndbc.noaa.gov/proj_overview/sensors_ndbc.shtml

You can actually search some of their sensors. Pricey (I mean... it probably costs a LOT in fuel and labor to send a boat out to put the expensive buoy in these places anyways!).

*Wind Sensor

Not sure how useful but it's interesting.

kb1lqc commented 7 years ago

Oh neat, here are some more specifications for buoys

Drifter Moored

kb1lqd commented 7 years ago

I Soldered jumpers to the pins on Faraday to allow bit-banged I2C. Note that I needed to use AD2 as a GPIO because it is the only GPIO port left with interrupt capability externally.

image

I also hooked up the RPI to I2C for both basestation I2C ADC to sense shutdown voltage and if it is needed to just use for I2C sensors.

image

@kb1lqc will be interested.

kb1lqd commented 7 years ago

@kb1lqc

I just used adafruits library and instructions for the ADS1015 ADC using I2C with the Rpi and I'm reading ADC values!

image

This is useful for auto-shutdown and basestation temps but also shows work system/python I2C ADC interaction.

I'll work on Faraday's I2C bitbang tommorow...

kb1lqd commented 7 years ago

@kb1lqc (Read all, especially near bottom)

I found http://www.ti.com/lit/an/slaa703/slaa703.pdf which the ZIP download has usable code it seems. This does need a timer that I may not have right now.

My setup took me a while after getting home today and now code composer isn't seeing Faraday... I may try again not at 11PM.

I'm wondering how long I give tying to get Faraday to bit bang I2C versus just use the working Rpi I2C? I know that keeping the smart modem capability is ideal but wondering how much, at least for now to keep things moving.

Faraday Base I2C

Rpi Based I2C

I think that we might want to consider if moving to a much more scale-able telemetry creation implementation is a good idea and base it heavily on RPi? Maybe leave the ability for Faraday's base telemetry but add/modify to easily scale into N amount of data from a RPi through proxy that is sent over RF.

Maybe Faraday abstracts a "telemetry" packet and type like it does now but add the functionality to sends new packets from a remote computer source (RPi).

Currently: Telem Packet #1 = System data (i.e. frequency) Telem Packet #2 = Debug information Telem Packet #3 = Faraday Sensor Telemetry (i.e ADC/GPS/etc...)

Maybe the easiest to do is just add additional packet types (i.e. #4) and let them come from the RPi itself and Faraday simply wraps it and sends is as a telemetry packet?

If we do this do we want to both with I2C on Faraday right now and just have RPi do it? This leaves any basic GPIO/ADC's for Faraday but any hardcore sensors go to I2C on RPi.

This may spur a small side project on Faraday Software for a "Sensors/Telemetry Generating Program" that runs with Proxy to gather and create generic telemetry...

kb1lqc commented 7 years ago

I'll respond in the morning @kb1lqd but it occured to me. What about using I2C SRAM instead of switching between SPI and I2C? This seems to solve the crossing of the stream so-to-speak.

kb1lqc commented 7 years ago

You should at least give I2C a shot on Faraday. It makes sense to not have to use the RPI to do this. In the future we may want to delegate much to the RPI I agree.

Make sure to consider the options that would make this quicker. What do you think about using an I2C to SPI converter and keeping everything SPI to the CC430 and all external I2C goes through the converter? the CP2120 is an example and here is a dev board. Building a simple converter board or finding a low-cost alternative could help us immensely. Let's not brute force this is we don't have to.

Will a SPI to I2C converter help a lot?

kb1lqc commented 7 years ago

Sensors in transit @kb1lqd:

kb1lqd commented 6 years ago

Sensors received. Closing to allow integration and scalings to be tracked with more granularity after this initial selection and system design.