Mcp3008 with reef-pi

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
13
Reaction score
4
Location
ottawa
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?
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,337
Reaction score
2,576
Location
Sacramento, CA area
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
H

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
13
Reaction score
4
Location
ottawa
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,337
Reaction score
2,576
Location
Sacramento, CA area
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:

 
Aquarium Specialty - dry goods & marine livestock
OP
H

haley-pi

New Member
View Badges
Joined
Aug 14, 2020
Messages
13
Reaction score
4
Location
ottawa
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,337
Reaction score
2,576
Location
Sacramento, CA area
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
8,373
Reaction score
14,880
Location
Palo Alto, Bay Area
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
8,373
Reaction score
14,880
Location
Palo Alto, Bay Area
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.
 

Would you love to have a super cool anemone? (these are the best)

  • YES

    Votes: 326 81.3%
  • NO

    Votes: 68 17.0%
  • Other (please explain)

    Votes: 7 1.7%

Online statistics

Members online
703
Guests online
3,771
Total visitors
4,474
Top