Mcp3008 with reef-pi

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
15
Reaction score
7
Location
ottawa
Rating - 0%
0   0   0
Hey,

I am working on a reef-pi project. I have an analog sensor set up to my Pi using the mcp3008.
I want to set up reef Pi so it does the following.

1. recognizes the analog input
2. Turns off a pieces of equipment based on the analog value.

I already have the equipment to be controlled in set up in Reef Pi. so it’s really about how to set up the analog device to control it

anyone know how to do this?
 

Ron Reefman

Lets Go Snorkeling!
View Badges
Joined
Aug 12, 2012
Messages
9,281
Reaction score
20,866
Location
SW Florida
Rating - 0%
0   0   0
Bump
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,950
Reaction score
3,351
Location
Sacramento, CA area
Rating - 0%
0   0   0
Hey,

I am working on a reef-pi project. I have an analog sensor set up to my Pi using the mcp3008.
I want to set up reef Pi so it does the following.

1. recognizes the analog input
2. Turns off a pieces of equipment based on the analog value.

I already have the equipment to be controlled in set up in Reef Pi. so it’s really about how to set up the analog device to control it

anyone know how to do this?

How familiar are you with writing software in Go? You'll need to add a MCP3008 driver to ReefPi, which will require using the SPI device in Linux from Go.
 
OP
OP
H

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
15
Reaction score
7
Location
ottawa
Rating - 0%
0   0   0
How familiar are you with writing software in Go? You'll need to add a MCP3008 driver to ReefPi, which will require using the SPI device in Linux from Go.
I have programmed in other languages before, never go. Apparently it was made to be simple, so that’s good!

I switched sensors to one that has a native digital out, so that will probably make things easier.

Does reef Pi have documents about their file structure, and where the appropriate files to edit would be?
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,950
Reaction score
3,351
Location
Sacramento, CA area
Rating - 0%
0   0   0
I have programmed in other languages before, never go. Apparently it was made to be simple, so that’s good!

I switched sensors to one that has a native digital out, so that will probably make things easier.

Does reef Pi have documents about their file structure, and where the appropriate files to edit would be?

The drivers repo is what you want to start on:


I recommend looking at the ADS11x5 driver and replace calls for the MCP3008:

 
OP
OP
H

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
15
Reaction score
7
Location
ottawa
Rating - 0%
0   0   0
Thank you so much!!!

[QI recommend looking at the ADS11x5 driver and replace calls for the MCP3008:
[/QUOTE]
I ended up finding a better sensor that sent information via I2C, which I believe reef-Pi already accepts.

however, it seems it only allows me so add a thermometer that way, so I will be jumping into Go any way!

unless there is a way to have Reef-Pi accept another i2c sensor as an inlet
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,950
Reaction score
3,351
Location
Sacramento, CA area
Rating - 0%
0   0   0
The ADS1115 is well supported. Used primarily for the pH circuits right now.
Some of the ReefPi plumbing for specific modules is very coupled to certain types of sensors. For example a “temperature” right now pretty much has to be a DS18B20 attached to the kernel’s 1-wire bus.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thank you for considering reef-pi. As @theatrus mentioned, mcp3008 driver is not present, instead use ads1115. Its i2c , so less wires and more precision.
The current ds18b20 integration was built before the newer hardware abstraction layer, hence its little coupled, but that does not mean you cant experiment with alternate sensors. I use sht31d sensor to get both temperature and humidity in another setup. For the time being, they have to be modeled under the ph tab, but functionality wise its same (control, monitor, alerting wise).
You should be able to use ntc style thermocoupler with ads1115 ADC module.
Another thing to remember is that reef-pi has a filedriver module, that you can use to tinker with any other type of sensor that is not yet supported by reef-pi. Just add enough code to get the sensor value and write it in a file (using circuit python or whatever you prefer), and reef-pi can poll that file and use the value for control/monitoring purpose.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thank you so much!!!

[QI recommend looking at the ADS11x5 driver and replace calls for the MCP3008:
I ended up finding a better sensor that sent information via I2C, which I believe reef-Pi already accepts.

however, it seems it only allows me so add a thermometer that way, so I will be jumping into Go any way!

unless there is a way to have Reef-Pi accept another i2c sensor as an inlet
[/QUOTE]
You should be able to use multiple i2c sensors as long as they have distinct address. How the exact sensor is mapped to the connector depends on the driver. Drivers are responsible for hiding those details and exposing pins that can be used for digital input/output or analog input. For example the sht31d exposes two pin (0, 1) one each for humidity and sensor.
 

More than just hot air: Is there a Pufferfish in your aquarium?

  • There is currently a pufferfish in my aquarium.

    Votes: 30 17.9%
  • There is not currently a pufferfish in my aquarium, but I have kept one in the past.

    Votes: 27 16.1%
  • There has never been a pufferfish in my aquarium, but I plan to keep one in the future.

    Votes: 32 19.0%
  • I have no plans to keep a pufferfish in my aquarium.

    Votes: 71 42.3%
  • Other.

    Votes: 8 4.8%

New Posts

Back
Top