what the log says?That's where I'm trying to name & assign them, in the connectors settings.
I was able to bypass the problem by using my tablet connecting to the reef pi server instead. Now I'm just having issues getting the relays to respond.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
what the log says?That's where I'm trying to name & assign them, in the connectors settings.
I was able to bypass the problem by using my tablet connecting to the reef pi server instead. Now I'm just having issues getting the relays to respond.
Some changes required. you have imported time twice. remove the second import statement inside the loop. light_id 's are not light names. If I understand correctly , you have three lights defined, and each of them has 5 channels (East, West, Center). The final value has to be converted into int, pwm_value/40.96 can be a float, so wrap that in int(pwm_value/40.96). I'll share an updated code soon...So I'm hoping to be able to try this out this weekend, but if you have a chance to glance at it, does this look like it might work?
Code:import requests import time from datetime import datetime from datetime import time from datetime import date import math num_expansions=15 #0 = White East #1 = White Center #2 = White West #3 = Blue East #4 = Blue Center #5 = Blue West #6 = OCW East #7 = OCW Center #8 = OCW West #9 = Violets East #10 = Violets Center #11 = Violets West #12 = Moonlight East #13 = Moonlight Center #14 = Moonlight West #15 = NOT USED #on time for channels 0-15 (15 is not used) on_hour=[9,9,9,8,8,8,9,9,9,8,8,8,19,19,19,0] on_minute=[0,15,30,0,15,30,15,30,45,15,30,45,0,15,30,0] #off time for channels 0-15 (15 is not used) off_hour=[18,18,18,20,20,20,17,18,18,19,20,20,9,9,9,0] off_minute=[0,15,30,0,15,30,45,0,15,45,0,15,0,15,30,0] #how long it takes for light to dim from min to max and max to min slope_length=[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,0] slope_length=[i*600 for i in slope_length] #the minimum PWM value from 0-4095 startPWM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] #the maximum PWM value from 0-4095 endPWM=[1433,1433,1433,3841,3841,3841,1638,1638,1638,3686,3686,3686,220,220,220,0] pwmDelta=[y-x for x,y in zip(startPWM,endPWM)] pwm_value=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] smoothPhase=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] lastsecond=0 while True: #to run the pwm function 1 time per second import time currentsecond=int(round(time.time())) currentsecond=int(currentsecond) if currentsecond>lastsecond: lastsecond=currentsecond+0 #add how many seconds delay over 1 to 0 now=datetime.now() current_hour=now.hour current_minute=now.minute current_second=now.second for a in range(num_expansions): start=[i*60 for i in on_hour] start=[x+y for x,y in zip(start,on_minute)] start=[i*600 for i in start] end=[i*60 for i in off_hour] end=[x+y for x,y in zip(end,off_minute)] end=[i*600 for i in end] current=(current_hour*60)+current_minute current=(current*600)+(current_second*10) if current<=start[a]: pwm_value[pwm_value[a]]=0 if current>=end[a]: pwm_value[pwm_value[a]]=0 if current>start[a]: if current<end[a]: pwmDelta[a] = endPWM[a]-startPWM[a]; if current > (start[a] + slope_length[a]): if current < (end[a] - slope_length[a]): #we are at the maximum value pwm_value[a]=endPWM[a] else: #we are in the phase down smoothPhase[a]=(((end[a]-current)/slope_length[a])*180)+180 pwm_value[a]=startPWM[a]+(pwmDelta[a]*((1+(math.cos(math.radians(smoothPhase[a]))))/2.0)) else: #we are in the phase up smoothPhase[a]=(((current-start[a])/slope_length[a])*180)+180 pwm_value[a]=startPWM[a]+(pwmDelta[a]*((1+(math.cos(math.radians(smoothPhase[a]))))/2.0)) else: #we are after the ramp down has finished pwm_value[a]=0 else: #we are before the ramp up has started pwm_value[a]=0 #print('Press Ctrl-C to quit... PWM value for channel',a,'is',pwm_value[a]) if (a==0) or (a==3) or (a==6) or (a==9) or (a==12): light_id = "East" if (a==1) or (a==4) or (a==7) or (a==10) or (a==13): light_id = "Center" if (a==2) or (a==5) or (a==8) or (a==11) or (a==14): light_id = "West" pin = a #this needs to change to correct pin ip = "127.0.0.1:8080" auth = ("reef-pi", "reef-pi") u = "http://" + ip + "/api/lights/" + light_id resp = requests.get(u, auth=auth) light = resp.json() light["channels"][pin]["auto"] = False #change the light to fixed mode light["channels"][pin]["fixed"] = pwm_value/40.95 #PWM value in % - should be changed in future resp = requests.post(u, auth=auth, json=light) #update light #pwm.setPWM(a, 0, pwm_value[a])
I am not sure of the lowest PWM value that I can dim to, but it is less than 1-2%Some changes required. you have imported time twice. remove the second import statement inside the loop. light_id 's are not light names. If I understand correctly , you have three lights defined, and each of them has 5 channels (East, West, Center). The final value has to be converted into int, pwm_value/40.96 can be a float, so wrap that in int(pwm_value/40.96). I'll share an updated code soon...
Question: your lights dim smoothly across the entire 0-100% range? For kessil i have seen we cant dim it below 13% (it flickers below that), i was under the assumption that all other lights have same limitations.
My lights work fine to, and I got a job lot of lm2569's from china 20 for £3.00 or in your money I'm guessing around $5I think I have mentioned earlier, but I’ll repeat that even with this, the kessil controller works flawlessly if I use pca9685 and a dedicated build
gpio4 is used by temperature sensorsI'm all good now. Is there something in the code that prevents is from using GPIO4? I tried starting on that one & it refused to work. All the others worked fine. I may just have a dead pin.
I've made the changes to the code that you said, except for the light id. Where do I find the light_id?Some changes required. you have imported time twice. remove the second import statement inside the loop. light_id 's are not light names. If I understand correctly , you have three lights defined, and each of them has 5 channels (East, West, Center). The final value has to be converted into int, pwm_value/40.96 can be a float, so wrap that in int(pwm_value/40.96). I'll share an updated code soon...
Question: your lights dim smoothly across the entire 0-100% range? For kessil i have seen we cant dim it below 13% (it flickers below that), i was under the assumption that all other lights have same limitations.
Yes .. I have one that is 12 feet long in a sensorHey
Next dumb question :)
The wires on my FS-IR02 level sensor are way too short. Will it be a hassle if I extend them? I can't imagine so as it's only an on / off signal, not a reading like Ph or Temp??
Thanks
Hi to all.try to install reef-pi now for 4-5 times,something always wrong.Yesterday was almost working,today morning i try again to log in with localhost:80 and something go wrong again,it try to download reef-pi when i go to web browser.Evennow i try to downgrade to reef-pi1.0 now go to the web browser but give me wrong msg. reef-pi is running but the msg is 404 not find
Should be ok. I have also bought other optical sensors (with same 4pin jst connector) with longer cable lengthHey
Next dumb question :)
The wires on my FS-IR02 level sensor are way too short. Will it be a hassle if I extend them? I can't imagine so as it's only an on / off signal, not a reading like Ph or Temp??
Thanks
dont use pi's 5v pin. you cant draw a lot of current from there... you can power things like pca9685 or some other ICs, but not LEDs. Use a dedicated power supply for the LEDs.Hi to all. Like to ask do i need to use external 5v to drive my 8ch relay board,or just use the Raspberry 5v pin.Thank you
you can get the light ids by making an api call to list all lights and iterating over the result, each entry is one lightI've made the changes to the code that you said, except for the light id. Where do I find the light_id?
resp = requests.get("http://localhost/api/lights", auth=auth)
lights = resp.json()
lights[0]["name"]
lights[0]["id"]
Can you tell us more about your setup.. what pi, how you installed it, share the logs etc.Hi to all.try to install reef-pi now for 4-5 times,something always wrong.Yesterday was almost working,today morning i try again to log in with localhost:80 and something go wrong again,it try to download reef-pi when i go to web browser.Evennow i try to downgrade to reef-pi1.0 now go to the web browser but give me wrong msg. reef-pi is running but the msg is 404 not find
@Ranjib I was wondering what you thought of this project? If it's something that might be usable or useful for reef-pi projects.
https://www.kickstarter.com/project...ay-card-for-raspberry-pi-2-3-zero/description
I think this has been done .. https://www.amazon.com/Raspberry-Pi-Expansion-Module-XYGStudy/dp/B01G05KLIE