OpenSprinkler › Forums › OpenSprinkler Mobile and Web App › OpenSprinker with Pine64
- This topic has 6 replies, 2 voices, and was last updated 8 years, 2 months ago by cremeikas.
-
AuthorPosts
-
June 12, 2016 at 10:25 am #42958
cremeikasParticipantWith the release of the pine64, I’m curious if it would be possible to use the OpenSprinkler android app but use my own hardware built around on the pine.
In general, is it possible to use home brewed hardware with the software?
June 20, 2016 at 10:11 am #43063
RayKeymasterIt should be reasonably easy to modify the firmware to support pine64. Specifically, the firmware currently can be compiled on any Linux based system. In fact you can compile it on a Linux PC and run it in simulation mode without any actual OS hardware. To adapt to pin64, the main modifications I believe would be to provide the pin definitions in defines.h and change gpio.h/.cpp to match gpio commands on pine64.
August 23, 2016 at 2:01 pm #43853
cremeikasParticipantGreat
Thanks for the reply and the pointers on what to mod. Also, pretty nice to know about the simulation mode… I’ll get that a shot first to play around with the softwar
August 31, 2016 at 9:15 am #43965
cremeikasParticipant<quote> To adapt to pin64, the main modifications I believe would be to provide the pin definitions in defines.h and change gpio.h/.cpp to match gpio commands on pine64.</quote>
A quick follow up to this Ray,
Got my pine all setup to start trying to build and test on, and curious about some of the defines.
I think most of the functions in gpio.h/cpp are fine, calling the gpio pins through sysfs is pretty much the same from pi to pine. My question is about some of the defines:
I’m assuming these are the pin definitions
#define OS_HW_VERSION OSPI_HW_VERSION_BASE #define PIN_SR_LATCH 22 // shift register latch pin #define PIN_SR_DATA 27 // shift register data pin #define PIN_SR_DATA_ALT 21 // shift register data pin (alternative, for RPi 1 rev. 1 boards) #define PIN_SR_CLOCK 4 // shift register clock pin #define PIN_SR_OE 17 // shift register output enable pin #define PIN_RAINSENSOR 14 // rain sensor #define PIN_FLOWSENSOR 14 // flow sensor (currently shared with rain sensor, change if using a different pin) #define PIN_RF_DATA 15 // RF transmitter pin #define PIN_BUTTON_1 23 // button 1 #define PIN_BUTTON_2 24 // button 2 #define PIN_BUTTON_3 25 // button 3 #define PIN_FREE_LIST {5,6,7,8,9,10,11,12,13,16,18,19,20,21,23,24,25,26}
But I’m a little unsure of some of the specifics. I’m using all of my own hardware for this, and from reading through the firmware code it seems as if there is some sort of controller that is used to control the valves indirectly.
I’m assuming SR_DATA and SR_LATCH are the primary pins that are providing the action for toggling on / off valves?
From the apply_all_station_bits function:
for(s=0;s<8;s++) { ... digitalWrite(PIN_SR_DATA, (sbits & ((byte)1<<(7-s))) ? HIGH : LOW ); ... }
In this context, does a station equate to a valve?
I feel like I’m missing some sort of relationship between the PIN_SR_DATA and each of the valves
Edit: So I think I understand a bit, it seems you are using some additional hardware to control the valves indirectly through some sort of relay that possibly takes an 8bit value to control the 1 available valves?
Thanks!
September 3, 2016 at 6:51 am #43982
cremeikasParticipantTo follow up on this again after a few days of going through the code, I think I mostly see what’s going on.
I’m doing this as a learning experience in using OOP and some new concepts, so I think I’m going to mostly rewrite a firmware version based on the unified version. I may restart a thread in a more appropriate section of the forum for anyone interested.
September 12, 2016 at 10:55 am #44040
RayKeymasterThose PIN_SR_xxx defines are for shift register. OSPi uses a shift register to drive many valves (including those on expansion boards) with just 4 GPIO pins. If you don’t use a shift register, you can use the GPIO station feature which is available in the current firmware. Specifically, the GPIO station is a station that’s drive directly by a GPIO pin, not through shift register. The PIN_FREE_LIST specifies free pins that can be used for GPIO stations.
What i suggest you do is to assign some dummy values to the PIN_SR_xxx’s, and make sure you don’t use these pins for anything else (because the firmware will toggle these pins assuming there is a shift register connected to these pins). Instead, you provide a list of free pins for PIN_FREE_LIST, and when you run the firmware, you can click on the gears icon next to each station name, to open the station attribute dialog, then go to ‘Advanced’ and choose ‘GPIO’ station, and select a free pin from the list. That way, you can bypass shift register and directly use GPIO to drive a station.
September 16, 2016 at 11:40 am #44075
cremeikasParticipantAwesome Ray,
I noticed that it seemed like it was possible to do this based on the code but wasn’t quite sure how to do it through the app. I think I’ll probably use this method for now!
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Mobile and Web App › OpenSprinker with Pine64