Forum Replies Created
-
AuthorPosts
-
RayKeymasterA while back Dan in CA sent me some instructions on how to use RTC with RPi. I tried and they seem to work. I’m posting his instructions here, hope these help:
FYI
after a few different iterations, here are the settings I used to access the RTC:1. added following lines to /etc/modules (sudo nano /etc/modules)
i2c-bcm2708
rtc-ds1307
2. added following line to /etc/rc.local
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device3. Reboot
must be root or use sudo: hwclock -r to read clock.
set the hardware clock from the current system time: hwclock -w
set the system time from the hardware clock: hwclock -sFollowing up on the RTC stuff:
You must ‘sudo -s’ before you can set the RTC.
RayKeymasterSteve, are you referring to the changes in formware 1.8.3 (vs the previous version 1.8.2)? The changes are all documented in the GitHub commit messages, and README.txt. For example, the commit message of 1.8.3 says:
main changes are 1) added back support for concurrent running mode; 2) new ‘device_id’ option which allows modifying the last byte of the controller’s mac address.
RayKeymasterThe Mac address issue has been addressed in firmware 1.8.3. Specifically, the last byte is now set as an option value which can be changed by the user. Random Mac address is also possible and may be considered for the next version.
RayKeymasterSteve,
If you haven’t noticed it, you should check the OpenSprinkler Pi project: http://pi.opensprinkler.com. This may be what you are looking for.
Regarding your questions:
– The flash is mainly consumed by program code, scheduling algorithms, and a small amount of the Javascript code for serving webpages. The bulk of the Javascript has been moved to external files stored on rayshobby.net server (otherwise there is no way to fit everything in 32KB of flash memory space). The EEPROM is mainly consumed by program settings, program data, and controller settings.
– Server related functions are all in server.pde (pde is the Arduino extension, it is really a cpp file)
RayKeymasterIf you have to run in parallel mode (sequential is off), you can modify the following line:
in interval_program.pde, around line 191, change
if (curr_minute != last_minute) {
to
if (seq==0 || curr_minute != last_minute) {this forces the algorithm to check program match at all times, instead of once every minute. Again, this change is very experimental, so use it at your own discretion.
RayKeymasterThanks for the feedback. I am glad OpenSprinkler Pi has been useful for your project.
RayKeymasterJosh,
No problem. You made a good point, so I went on and modified the instructions to make it clear that VIN and VCC voltages are measured in DC. Thanks.
RayKeymasterThese voltages are too high. Something is wrong. Try to power the controller through USB (instead of transformer), and measure the VIN and VCC voltages again. Also, you can measure the resistance between VIN and GND, also VCC and GND, and see if there is any potential shorting.
RayKeymasterYou don’t need to change the fuse bits unless if you are using an MCU that’s purchased separately elsewhere.
Regarding the power consumption: you need to discount the power loss on the switching regulator (about 75% efficiency regardless of the output/input voltage ratio) and the 5V->3.3V linear regulator (effectively 3.3/5 = 66% efficiency). For example, if the input voltage is 12V and current draw is 0.1A, the switching regulator will lose about 12 * 0.1 * 25% = 0.3 Watt, and the linear regulator will lose 12 * 0.1 * 75% * 34% = 0.31Watt. So about 0.61 Watt is wasted just on the voltage conversion.
RayKeymasterI am out of the country. Will take a look at your board after I get back Saturday next week.
To answer some of your earlier questions:
– all MCUs we ship are pre-programmed with the correct fuse bits. I assume yours are correct, otherwise you won’t be able to upload a program. in any case, did you by any change change the fuse bits?
– the default fuse bits set the MCU to use internal 8MHz RC oscillator. ‘Internal’ means it’s not connected to any external oscillator pins.
– The Ethernet controller typically draws about 180-200mA current during operation, so the power consumption is roughly 3.3V * 0.2 = 0.66 watt. Your measurement of 1 Watt does seem a bit high. How did you measure the power consumption?
RayKeymasterLook, if you can upload a program, that means the MCU is alive: it has to be functional and respond to SPI in order to receive program data and send data back for verification. So I am pretty sure your mcu is alive. If you want to check this more explicitly, you can flash an Arduino program that toggle a digital pin and place an LED across that pin with ground to see if the LED is flashing. The easiest would be digital pins 16 and 17 (which are also analog pins A2 and A3), these two pins are accessible in the pin out area.
Regarding the Ethernet jack schematic: the one published online is for the previous version of 1.4u (which uses SparkFun Ethernet jack). The new 1.4u (Oct 2012 version) is using the same Ethernet jack as the SMT version 1.4s:
https://github.com/rayshobby/opensprinkler/raw/master/OpenSprinkler%20Controller/hardware/v1.4/smt/OpenSprinkler_v14_smt.png
If you take a look, it does show pin 4 and 5 as the center taps, which match the datasheet.You mentioned: ” I no longer get a short between R4 and I get 50 ohms as expected”, I am losing the context here: did you mention that you had a short before?
If you still can’t figure out the LCD problem, you are welcome to send the kit back to me so I can take a look. However, I am traveling out of the country today, and will be back Saturday next week.
RayKeymasterThere are a few other potential causes, for example:
– the LCD might be damaged, although this is very unlikely unless if you have reason to believe that it’s damaged by 24VAC
– the MCU’s reset line (pin 1) is for some reason held to ground, causing the MCU to remain in reset state (also very unlikely since you can program the MCU successfully).
RayKeymasterHmm, that’s very strange. For the LCD to display that message, it really just requires a running MCU and connections from the MCU to LCD. Some questions/suggestions:
– I assume you have hardware v1.4u, right?
– could you post the number of bytes written as reported by avrdude?
– check the connections from MCU pins to LCD, specifically the following (note the MCU pins are referring to the pin numbers on the body of the MCU, not the Arduino logic pin numbers):
(mcu pin to LCD pin):
2 -> E
3 -> RS
6 -> DB4
11 -> DB5
12 -> DB6
15 -> DB7
RayKeymasterJust to make sure we are on the same page: you said the LCD does not display any message, is that still the case after flashing the firmware the correct way? The fact that you can flash firmware means the MCU is up and running, and if so the LCD should display a ‘Connecting to the Network’ message, independent of whether the Ethernet controller is up running or not.
RayKeymasterThe binary size (32768) does not look right. It should be a few hundred bytes less than that. Note that if you are downloading 1.8.2.hex firmware as an individual file, you should use the ‘Raw’ file link in GitHub, not ‘Save File As’, or ‘Save Link As’. Here is the direct raw file link of firmware 1.8.2 for OpenSprinkler v1.4:
https://github.com/rayshobby/opensprinkler/raw/master/OpenSprinkler%20Controller/software/compiled/v1.4/firmware1.8.2.hex
RayKeymaster@elek: I don’t completely understand how the controller works. Do you have the brand name / model number, or a link to the manufacturer website?
RayKeymasterI agree. The cable is sufficient to carry power over a long distance (as long as you use thick enough wire), but the issue is in the signal quality, especially if the mcu is sending out serial clock at a high speed. You can feel free to give it a try, but I suspect that it won’t be very reliable. Instead of wiring the expansion board 100 feet away, is it possible to place the expansion board close to the main controller, and extend the wires to those valves?
RayKeymasterHi Steve,
Sorry that I didn’t notice this thread yesterday. Since the first version of OpenSprinkler,Ethernet Jack has been changed a couple times to reduce cost: initially Pulse J00-0061NL, then SparkFun’s Ethernet jack, and now Hanrun HR911105A. Unfortunately these jacks have very different pinouts, so it’s important to know exactly which part to use for each PCB. Particularly, the extension boards are sometimes using undocumented PCBs. If you need, I can send you the schematics, but in general I don’t provide part number or build instructions for undocumented PCBs.
The Dec 2011 PCB uses SparkFun’s Ethernet jack: https://www.sparkfun.com/products/8534
Hope this helps.
RayKeymasterOK, I think I found a potential solution to the issue. First of all, the 1 second delay is because the program only checks and performs bookkeeping of running time once every second. This is to give sufficient time share to the Ethernet controller in order to improve response time to web requests. Therefore, after a schedule is finished, the program goes back to the beginning of the loop (where it checks web requests), and does not perform scheduling until a new second comes. So the quick fix is that after a schedule is finished, let the program re-do schedule checking before going back to the beginning of the loop, and this should solve the problem.
Specifically, you need to add the following two lines in inverval_program.pde:
1. Before the comment // ====== Schedule program data ====== and after svc.rainsensor_status();, add a label, such as:
svc.rainsensor_status();
CHECK_PROGRAM_SCHEDULE:
// ====== Schedule program data ======2. Locate code “mas = svc.options[OPTION_MASTER_STATION].value;” around line 307, and add the following line after that:
goto CHECK_PROGRAM_SCHEDULE;Basically this directs the program to go back to schedule check after a previous program is finished, and it should eliminate the 1 second delay.
Note that this only works when sequential option is turned on. If you want to run the controller in parallel mode, there is an additional change you should make. Also, keep in mind that this has not been tested thoroughly, it’s a rather ad hoc solution. Give it a try and see if it works.
RayKeymasterRegarding the serial port: please follow the re-programming instructions — you only need to select board and then click on Upload, there is no step to select a serial port. This is because OpenSprinkler does not have a USB-serial chip (which the standard Arduino has).
I will take a look at the timing issue as soon as I can. Meanwhile, have you considered adding a UPS backup power supply? That may be the simplest solution to the power interruption problem.
March 6, 2013 at 4:17 am in reply to: Running Opensprinkler in Parallel with existing controller? #23403
RayKeymasterWithout knowing the internal circuitry of your manual controller, it’s hard to tell. For example, on some controllers the COM wire is the logic ground of the circuit, while on OpenSprinkler it’s not. If you try to connect the two in parallel without knowing these details, it may directly short the sprinkler transformer. So unless if you are confident about how the manual controller works internally, I don’t recommend connecting them in parallel.
RayKeymasterThat’s a good suggestion. I am planning to use mcu’s watchdog timer for this. The very first version of the firmware actually did use watchdog timer to prevent deadlocks. But I removed it later. The shift register is now refreshed every second.
RayKeymasterYou can install VirtualBox and run a virtual Linux system in Windows, as described here:
http://rayshobby.net/?page_id=732#compile
I recommend Ubuntu 12.04 or Linux Mint 13, which comes with avr-gcc 4.5.3.February 24, 2013 at 1:06 am in reply to: OpenSprinkler Pi demo scripts might need to be edited #23393
RayKeymasterThat’s probably because the program did not clean up the GPIO when it terminated during the last run. I think I’ve added code to call GPIO.cleanup upon pressing CTRL+C, but maybe the program terminated in some other way.
February 24, 2013 at 12:08 am in reply to: OpenSprinkler Pi demo scripts might need to be edited #23391
RayKeymasterHi Ric,
Thanks for pointing this out. Indeed I had no idea there are two versions. I suppose this is a Python library/software thing (since you said the c program worked). I will post about this on my blog.
-
AuthorPosts