Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Hi all, need help for a greenhouse projec
Author | Message | ||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
I need to built automation for aquaponics greenhouse with the maximite. i know little about programming exept that i still have my old color computer 2 trs80 and i do some automation whit it in my youger times. first trouble, i buy a sensor http://www.robotshop.com/ca/en/dfrobot-light-sensor-bh1750.h tml and i dont know how to make it work, can someone explain how to do and give me program in mmbasic . i will use the sensor to control lighting for flowering. many thanks this is my website, www.shojigarden.com www.shojigarden.com |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Do you know any MMBasic programming? Some info for you: Use the I2C functions of MMBasic to control the module and read the data. The I2C address is decimal 35 or hexadecimal 23 with the ADD pin unconnected. You don't need to use pull-up resistors as they are included on the module. |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
many thanks for your help. can you write some line code that will read the light from the sensor, it will help me understand the basic of i2c. |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
please i need help to understand to use i2c if someone can help |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
You could try clicking this link. |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
bobd , do you have experience with i2c? |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 831 |
Hello Crostydown, I can give you my code for the Lightsensor ISL29023 which you can buy from Soldercore: "http://soldercore.com/products/sensecore/corelight/" It works very well with my Duinomite and MMBasic. '*****************************************************
'* * '* TESTPROGRAM FOR LIGHTSENSOR ISL29023 * '* Filename: ISL01.BAS * '* Date: 2013-10-25 * '* * '***************************************************** Clear Cls Pause 500 '*** Array Declaration *** Dim Licht_DAT(1) 'Array for LSB and MSB of candle power 'SDA is on Maximite-Pin 5, CLK on Maximite-Pin 6 ISL29023_addr = &h44 ' ISL29023 slave baseaddress I2CEN 400, 100 ' Enable I2C '*** Registers *** COMMANDI_R = &H00 COMMANDII_R = &H01 DATA_LSB_R = &H02 DATA_MSB_R = &H03 '*** Config Sensor *** I2CSEND ISL29023_addr, 0, 2, COMMANDI_R, &HA3 'Command Register I 00(hex): 'ALS continous, NUMBER OF INTEGRATION CYCLES = 16 GoSub CheckIIC I2CSEND ISL29023_addr, 0, 2, COMMANDII_R, &H02 'Command Register II 01(hex): 'n-BIT ADC = 16, FSR(LUX) @ ALS SENSING = 16000 (Range 3) GoSub CheckIIC '*** MAIN-PROG *** Start: GoSub LESE_SENSOR 'Print"LUX: ";Bin$(LUX(0));" ";Bin$(lux) 'Print Bin$(lux(0)) Print"Light: ";Bin$(Licht);" ";Licht; " LUX: ";LUX Pause 100 GoTo Start '*** Read Sensor *** LESE_SENSOR: 'First send Registeradress DATA_LSB_R, than read 1 Byte '(LSB) I2CSEND ISL29023_addr, 0, 1, DATA_LSB_R GoSub CheckIIC I2CRCV ISL29023_addr, 0, 1, Licht_DAT(0) GoSub CheckIIC 'receive MSB: I2CSEND ISL29023_addr, 0, 1, DATA_MSB_R GoSub CheckIIC I2CRCV ISL29023_addr, 0, 1, Licht_DAT(1) GoSub CheckIIC Licht = (Licht_DAT(1)*256 + Licht_DAT(0)) LUX = Licht * (16000/2^16) 'Alpha=Range(k)/2^n (see Datasheet S.6) Return '*** CheckIIC *** CheckIIC: If MM.I2C <> 0 Then Print"I2C-ERROR!" Return I hope the comments are useful... Frank |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Denis, yes, Bob |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
I had the same problem with a humidity sensor and one of the members 'seco61' very kindly wrote some code for me. Send him a PM maybe he can help. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
thanks, i will try and come back with the result |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
i try the code from Frank Furter and dont have value both something start to communicate because the mm.i2c change from 0 to 1 when i put the add wire fom positive to negative power |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6101 |
Did you get your sensor working? I received one in the post today and was able to have a successful play. ' reading the BH1750 light sensor ' in single shot mode. ' TassyJim 31 12 2013 Cls Dim LightData(2) BH1750address = &H23 ' BH1750 address I2CEN 400, 200 ' Enable I2C pause 200 I2CSEND BH1750address, 0, 1, &H01 ' Power on print MM.I2C pause 250 I2CSEND BH1750address, 0, 1, &H07 ' Reset pause 250 main: do I2CSEND BH1750address, 0, 1, &H01 ' Power on pause 50 I2CSEND BH1750address, 0, 1, &H20 ' 1x scaling, single reading pause 200 I2CRCV BH1750address, 0, 2, LightData(0) lux= (LightData(0)*256 + LightData(1))/1.2 Print "Light: ";format$(lux,"%7.1f");" lux" pause 750 k$=inkey$ loop until k$="q" I2CDIS end It is a lot better than using a resistor and LDR! Jim VK7JH MMedit MMBasic Help |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
MANY THANKS FOR YOUR HELP! my project start to run and i will receive the tft maximite this week. |
||||
akashh Senior Member Joined: 19/01/2014 Location: IndiaPosts: 115 |
Hi, please do not take this as a marketing post. I am also an aquaponics enthusiast and worked on several systems here in India. I built my own timers, etc. but this was before I built the Wattmon. One of my goals with the Wattmon has always been to control a complete aquaponics setup and I have various modules that could be put together with minimal programming for this purpose, such as pulse counter for water flow, analog inputs, digital inputs, and relays. I just have not found the time yet to build my setup. If you are interested in using a Wattmon I would be happy to assist in the customisation. The main reason to use such a device instead of the maximite would be the Internet connectivity, allowing you to get alerts and check the running status from anywhere, which IMHO is essential for aquaponics. I did not have it for my previous setups and it proved to be catastrophic a couple of times. The other project which I find great is by a guy in the US: http://www.kijanigrows.com/ He has apparently done it with a fully open sourced arduino. |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
Hi Akashh, thanks for the info. From my experience, INTERNET is not the safest way to know alarm in greenhouse. The best from now is a pager like paravox to call your cellular phone and is easy to link to the mighty maximite. |
||||
crosstydown Newbie Joined: 29/11/2013 Location: CanadaPosts: 23 |
Hi Akashh, thanks for the info. From my experience, INTERNET is not the safest way to know alarm in greenhouse. The best from now is a pager like paravox to call your cellular phone and is easy to link to the mighty maximite. |
||||
Print this page |