author
7Instructables26,125Views213CommentsAustraliaJoined June 3rd, 2015
I am a retired professional engineer, now farmer. Taking an interest in all things technological and in building devices useful on the farm.

Achievements

100+ Comments Earned a bronze medal
10K+ Views Earned a bronze medal
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AdhiN4, You obviously have a different version of the software from me. Google Translate tells me that the comment that is in your code is Indonesian and they translate it as "loop to read the rough value of adc". The version in this Instructable, written by deba168 and which I am looking at, has comments in English and more of them. The corresponding comment in that code says { // loop through reading raw adc values AVG_NUM number of times which I think is a bit more informative than the English translation of the Indonesian comment.The purpose of this code is to smooth out any noise that my be getting into the voltage readings. If you look in the preamble section, you will see that AVG_NUM is defined as 10. So this bit of code makes 10 measurements of whichever pin it is...

    see more »

    Hi AdhiN4, You obviously have a different version of the software from me. Google Translate tells me that the comment that is in your code is Indonesian and they translate it as "loop to read the rough value of adc". The version in this Instructable, written by deba168 and which I am looking at, has comments in English and more of them. The corresponding comment in that code says { // loop through reading raw adc values AVG_NUM number of times which I think is a bit more informative than the English translation of the Indonesian comment.The purpose of this code is to smooth out any noise that my be getting into the voltage readings. If you look in the preamble section, you will see that AVG_NUM is defined as 10. So this bit of code makes 10 measurements of whichever pin it is told to look at, adds all the measurements together, and divides the total by 10, thus getting the average of the readings rounded down to the nearest integer, which it returns as its result. If you need more clarification, or explanation, don't hesitate to ask again. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AdhiN4, It is a bit of a puzzle. It is not clear why the battery voltage seems to be jumping around. I would like you to try the following:a) in the function called void print_data(void) add 2 new statements just ahead of the first Serial.print statement, as follows:Serial.print("Time is "); Serial.println((float)millis()/1000,3);b) in the function called void charge_cycle(void) add 2 new statements right at the top (before the first test, but after the opening brace:Serial.print("bat_volt=");Serial.println(bat_volt);c) Instead of capturing a screen shot, press the button at the bottom left of the screen to stop it scrolling, and select a couple of screens full of the output, copy to your clipboard (edit copy) and paste it into a posting. That will give a sequenc...

    see more »

    Hi AdhiN4, It is a bit of a puzzle. It is not clear why the battery voltage seems to be jumping around. I would like you to try the following:a) in the function called void print_data(void) add 2 new statements just ahead of the first Serial.print statement, as follows:Serial.print("Time is "); Serial.println((float)millis()/1000,3);b) in the function called void charge_cycle(void) add 2 new statements right at the top (before the first test, but after the opening brace:Serial.print("bat_volt=");Serial.println(bat_volt);c) Instead of capturing a screen shot, press the button at the bottom left of the screen to stop it scrolling, and select a couple of screens full of the output, copy to your clipboard (edit copy) and paste it into a posting. That will give a sequence showing the transitions between states on multiple cycles. Keith

    I now understand you are saying, that if I label the first (left) screenshot 1, and the top half 1a and the bottom half 1b, then the sequence is 1a 1b 1a 1b 1a 1b ... and so on, when there is not much illumination; and that it changes to 2a 2b 2a 2b 2a 2b ... when there is full sun. Is that correct?

    Hi AdhiN4, Based on that understanding,

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi fonetainer, If you want to handle more power, it makes sense to go to a MPPT type of charger rather than a PWM charger. It is not that a PWM charger cannot handle more current, just that the amount of energy you will be losing will become sufficient to repay the extra cost of the more complext MPPT charger. Although I do not recommend it, to allow this PWM controller to handle more current, you would need to a) yes use a 20Amp ACs712and b) replace the MOSFETs with a different type with a lower RdsON, such as IRF4905 (instead of IRF9540). Keith

    Hi AdhiN4, I think you need to take a systematic step-by-step approach to working out the problem. You at least need a multimeter to measure voltages, and have your computer connected so you can put in some Serial.print() commands to check what the software is doing. If the battery is connected, but no solar panel, do you get what you expect? Are the voltages from the multimeter consistent with what the software sees. If not you should adjust the calibration factors in the software until they are close. When this part is right, connect your solar panel and use a shade over the solar panel to control its output. Get its voltage on the multimeter and in the software to be consistent. The charger behaviour mainly depends on solar_volt and bat_volt and its relationship to bulk_charge_sp an...

    see more »

    Hi AdhiN4, I think you need to take a systematic step-by-step approach to working out the problem. You at least need a multimeter to measure voltages, and have your computer connected so you can put in some Serial.print() commands to check what the software is doing. If the battery is connected, but no solar panel, do you get what you expect? Are the voltages from the multimeter consistent with what the software sees. If not you should adjust the calibration factors in the software until they are close. When this part is right, connect your solar panel and use a shade over the solar panel to control its output. Get its voltage on the multimeter and in the software to be consistent. The charger behaviour mainly depends on solar_volt and bat_volt and its relationship to bulk_charge_sp and float_charge_sp. If the battery voltage is less than the float charge set point (ie float_charge_sp) the PWM duty cycle should be high and the solar panel voltage should be only a little bit higher than the battery voltage. and the panel should be producing its full current capability. If the battery voltage is higher than the bulk charge set point, the PWM duty cycle should be low and the solar panel voltage should be at close to its open circuit value and several volts higher than the battery voltage with almost no current.I hope this helps. good luck,Keith

    Hi fonetainer, if you look at the schematic diagram which is attached at the end of Step 2, you will see several little connector flags with labels like A0, A1, ... D1, D2, .... These flags with An and Dn are all connections to the Arduino pins which have the same names on the Arduino nano module. The Arduino Nano also has +5V and GND connections (to its 5v and GND pins). Not all of the Arduino Nano pins have connections. If you have any confusion about which connections to make, feel free to ask about them. Keith

    Hi AdhhiN4, Can you please post a sample of your serial monitor output at a time when this blinking is happening? Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AdhiN4, It seems to me that you have made progress towards what you want, but the logic needs a bit of fixing. Two suggestions:a) Have a look at some of the examples provided with the Arduino IDE. I think the most relevant one is called Debounce; look for it in Files/Examples/Digital. b) Add some (temporary) debugging printouts to your code so you can see what is happening. For example, add a line like: Serial.print ("Line 340 bat_volt="); Serial.println(bat_volt);A few lines like this will let you see what your software is doing. The line number is there so you can easily identify at what point in the code it is checking, and also makes it easy to find the code when you have it working and want to delete all the temporary print commands. If you continue to have trouble, p...

    see more »

    Hi AdhiN4, It seems to me that you have made progress towards what you want, but the logic needs a bit of fixing. Two suggestions:a) Have a look at some of the examples provided with the Arduino IDE. I think the most relevant one is called Debounce; look for it in Files/Examples/Digital. b) Add some (temporary) debugging printouts to your code so you can see what is happening. For example, add a line like: Serial.print ("Line 340 bat_volt="); Serial.println(bat_volt);A few lines like this will let you see what your software is doing. The line number is there so you can easily identify at what point in the code it is checking, and also makes it easy to find the code when you have it working and want to delete all the temporary print commands. If you continue to have trouble, post your code so I can work out what the problem is. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AdhiN4, The additional code for the push button is going to be in the function void load_control () which in my version 2.0 of the software is at line 334+. But you need to be a bit clearer about how the button will operate. For example, do you want one push of the button to turn the load on, and a second push to turn the load off? One alternative is to wait for the next daytime (ie with solar_volt >5) and turn the load off then. I think you first need to clearly define how you want the button and the existing load control to interact. You will also need to decide which Arduino pin will sense whether the button is pushed or not. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AdhiN4, I think the current fuse (in series with the solar panel) is in the wrong place. If a solar panel is short circuited it will generate current not much higher than its maximum power point current and there will be no damage to any component. In this design, it would be better to put the fuse in series with the battery, which can generate very high and potentially damaging currents if it is short circuited. As for whether your windmill needs a fuse, that depends on its design. It is probably a good safety practice to put in a fuse if you are not sure.Keith

    Hi AdhiN4, It is a calibration problem. There are several factors that affect the results displayed on the LCD: resistor tolerances in the resistive dividers and the power voltage supplied to the Arduio being the main ones.. I think the best solution is to adjust the multiplier used in the voltage calculation in the software. In the function "void read_data (void)" (about line 150 in my copy) is where you will find the calibration constants for the 4 different measurements used. For example one of them is:solar_volt = read_adc(SOL_ADC)*0.00488*(120/20);You should change the value of 0.00488 to another value based on the ratio of the measured and displayed voltages. For example, if your multimeter reads Vm and the LCD shows Va, calculate Cnew = 0.00488 * Vm / Va and use that...

    see more »

    Hi AdhiN4, It is a calibration problem. There are several factors that affect the results displayed on the LCD: resistor tolerances in the resistive dividers and the power voltage supplied to the Arduio being the main ones.. I think the best solution is to adjust the multiplier used in the voltage calculation in the software. In the function "void read_data (void)" (about line 150 in my copy) is where you will find the calibration constants for the 4 different measurements used. For example one of them is:solar_volt = read_adc(SOL_ADC)*0.00488*(120/20);You should change the value of 0.00488 to another value based on the ratio of the measured and displayed voltages. For example, if your multimeter reads Vm and the LCD shows Va, calculate Cnew = 0.00488 * Vm / Va and use that.Keith

    View Instructable »
  • Solar Powered WiFi Weather Station

    Hi Deba168, Certainly the schematic is right. I can't see all of the connections in the pictures of the PCB layout (which seem to be the same, I expected them to be for the 2 different sides of the board). Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi fonetainer, You are missing two files. The first one is in the same repository as the software you are trying to compile. That is, https://github.com/farmerkeith/SolarChargerSZBK07M...The second one, RepeatEvery.h can be found at https://github.com/farmerkeith/executionControl/tr...Both of these files can be put into the same directory as the MPPT_SZBK07.ino file. Keith

    I omitted to answer about the LCD. You can choose any type that you want. The 2-line, 16 character displays are very inexpensive but quite restricted because they only have 2 lines. The other main option is a 4 line, 20 character display, which is more expensive but still quite affordable. Whichever one you choose, I suggest you get it with a serial backpack to conserve pins on your Arduino. Some of these modules can be puchased with the serial backpack pre-installed. If you buy the backpack separately, you can wire them yourself. If you need to do this, have a look at https://www.instructables.com/id/1602-LCD-Keypad-S...Keith

    Hi fonetainer, If you have the V2.0 PWM controller by deba168 as per this Instructable, you should be able to add a LCD to display voltages and currents. I suggest you use an LCD with serial backpack, so you can connect it to the Arduino Nano used in this controller. Your "also" project sounds like a lot more of a challenge. I think you need to start with the load energy you want to supply over night, and use that to size your battery, and from that you can work out the amount of solar panels you require. Have a look at this design which may be closer to what you have in mind.https://github.com/farmerkeith/SolarChargerSZBK07ModuleKeith

    Hi fonetainer, There is no content in the file SZBK07.kicad_pcb, so it won't help you much to open it. I put all the files that KiCad produced in the repository, but I have not done a PCB for this design so the pcb file is just a stub generated by KiCad with no contents.I don't know if you can run KiCad on your Mac. If you can, you should be able to open these files with it. I am using Linux so I am not familiar with using a Mac.

    View Instructable »
  • Solar Powered WiFi Weather Station

    Hi Deba168, Your schematic is correct. You do not have any choice for where the voltage divider ground goes, it is on the WeMos board and goes to the common ground on the board, which is OUT- on the TP4056 module. When the battery is charged and its voltage is above the drop-out value (about 2.8 V) the DW01 protection circuit on the TP4056 module connects the OUT- to B- and the voltage difference between the two will be very small. Also, on the TP4056 module, B+ and OUT+ are connected together, so it does not matter whether the top end of your divider goes to B+ or OUT+ (or even "5V" of the WeMos module). They are all the same voltage.Keith

    Hi Deba168, I did not think of this until you asked about PCB design. a) you could make the board compatible with sleep mode by connecting D0 to RST, either directly with a track (easiest) or via a solder link so that the user can choose to put in the connection or not. More fancy again: Since I expect the default mode will be to have the connection, you could make it a track and on the silk screen write an arrow and "drill here to break D0-RST". This is probably a bit extreme. As you will have observed there has been a lot of correspondence about using sleep mode so it is of interest to many people. b) I think it would be very valuable to make the board compatible with BOTH the 4-pin and the 6-pin versions of the BMP280 / BME280. Even though you wrote BMP280 on the silk scre...

    see more »

    Hi Deba168, I did not think of this until you asked about PCB design. a) you could make the board compatible with sleep mode by connecting D0 to RST, either directly with a track (easiest) or via a solder link so that the user can choose to put in the connection or not. More fancy again: Since I expect the default mode will be to have the connection, you could make it a track and on the silk screen write an arrow and "drill here to break D0-RST". This is probably a bit extreme. As you will have observed there has been a lot of correspondence about using sleep mode so it is of interest to many people. b) I think it would be very valuable to make the board compatible with BOTH the 4-pin and the 6-pin versions of the BMP280 / BME280. Even though you wrote BMP280 on the silk screen, your version actually uses a BME280 as I understand it. The first 4 pins of the 6-pin version of the BMP280 module are identical to the 4 pins of the 4-oin version. The extra pins on the 6-pin module are CSB and SD0. I provided instructions about them in the hardware section of my instructable on the BMP280 library https://www.instructables.com/id/Library-for-BMP28...Anyway, to use the I2C interface, CSB has to be connected to Vdd.The SD0 pin provides address control for the I2C interface, and can be connected to ground or to Vdd. Usually it will be connected to Ground so I think that would be fine for your PCB. If you wanted to give the user the full possibilities, you could include a solder link to enable either connection. These are just ideas. You did ask. Regards,Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi HakimA14, There are many circuit simulators "out there", mostly based on the "spice" simulation method. Your choice partly depends on what operating system you are running. In my own work I have been successful in using ngspice with KiCad. KiCad is used to draw the schematic circuit and produce a "netlist" suitable for spice. Ngspice is used to do the simulation. All this is running on my T420 laptop computer using Manjaro Linux. These software packages are free and open source. I found there were some incompatabilities between the KiCad netlist output and the ngspice input requirements, which I have solved using a shell script called "ng" which uses sed to do the translation. You can find all of this work, including many sample circuits and s...

    see more »

    Hi HakimA14, There are many circuit simulators "out there", mostly based on the "spice" simulation method. Your choice partly depends on what operating system you are running. In my own work I have been successful in using ngspice with KiCad. KiCad is used to draw the schematic circuit and produce a "netlist" suitable for spice. Ngspice is used to do the simulation. All this is running on my T420 laptop computer using Manjaro Linux. These software packages are free and open source. I found there were some incompatabilities between the KiCad netlist output and the ngspice input requirements, which I have solved using a shell script called "ng" which uses sed to do the translation. You can find all of this work, including many sample circuits and simulation results, on my github circuits repository: https://github.com/farmerkeith/circuitsKeith

    Hi AdhiN4, You cannot (or should not) just connect the windmill and PV panel in parallel. Nor do you need to duplicate the entire charger. Currently the input from the solar panel is connected to a transient surge suppressor, a voltage divider for voltage measurement, then through a power diode MBR2045. Your windmill input should have a duplicate set of those components. The cathodes of the two MBR2045 diodes will be connected together. This is to prevent the PV panel from taking current from the windmill when it is dark, and the to prevent the windmill from taking current from the PV panel when the wind is not blowing. You will also need to make corresponding changes to the software to take the higher of the two input voltages (PV and wind). Keith

    Hi fonetainer, Yes you can use this controller with a 100W solar panel. You panel is at the top end of the capabilities of this controller. You may want to consider using an MPPT controller such as https://github.com/farmerkeith/SolarChargerSZBK07... (although this is not in a "plug and play" status as yet.Keith

    View Instructable »
  • Solar Powered WiFi Weather Station

    Hi Glasgowbrian,Your serial monitor output and your mobile phone showing disconnection seem perfectly normal to me. The serial monitor output shows the initiation of a connectionn to the Blynk cloud server and its success. then your measurements. Then I presume your Wemos goes to sleep, which breaks the connection to the Blynk cloud and it shows on your mobile phone as a discconnection. My question is, after the delay you have set, does the Wemos wake up and go through the whole process again? If not, did you connect the D0 and RST pins?Keith

    No worries Glasgowbrian. Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi NorthC2, Yes this circuit, using the XL4016, can be used for that.Keith

    View Instructable »
  • 1602 LCD Keypad Shield Module With I2C Backpack

    Hi clemenlg, Your wiring in the photo looks correct to me, so it is not obvious what might be wrong. Do you have the exact same modules that are specified in the Instructable? There are several different ones on the market. If the backlight does not come on, you will not be able to see the characters in the display. So that is the first thing you need to get working. I have the following suggestion. In the setup() section, after lcd.setBacklight(LOW);I suggest you add:delay(1000);lcd.setBacklight(HIGH);delay(1000);lcd.setBacklight(LOW);And see if the backligh comes on briefly. That will indicate that the polarity is back to front. Good luck. Please let us know if that is the problem. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi JosephC298, Yes it can be used for a 12V 60AH battery. The limitations of the charger are for the charging current and load current.

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi AhhiN4, There are no guarantees with this, but if you want to handle higher currents then you should change the MOSFETs IRF9540 for MOSFETs with a lower ON resistance, such as IRF4905. You should probably also duplicate the power diode MBR2045. It may also be necessary to upgrade the driver circuit for the gate of MOSFET Q1, to reduce its switching time.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi NorthC2, The A4 and A5 pins on the Arduino are used for the I2C bus. An I2C bus can interface to many devices, because it uses a device address as part of its protocol. In this design it is used for the RTC and the LCD display. If you do not need the real time clock (RTC), then you can remove it. I put the RTC in the circuit so that the data logging function (on the micro SD card) can include time and date stamps on the data records. You should be aware that if you remove the RTC, it is currently providing the pull-up resistor for the D2 line used for the temperature sensor, and you will need to add a resistor from D2 to +5V. The resistor value can be 3.3K or 4.7K or thereabouts. You may need a lower value if you have very long wires to your DS18B20.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 7 weeks ago
    Solar Powered WiFi Weather Station

    Hi AlekseyFedorovich, I think that diode is not required.

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi David_0519, Here is a sample sketch with a filter function which I think will do what you have asked for. Copy the filter() function out of this sketch into your code before the setup() section. Then in void lcd_display() replace the following llinelcd.print(temperature);with lcd.print(filter(temperature));If that is not clear, or if you have trouble with it, please post your amended code so I can help you get it working.Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi NorthC2, I drew the ACS712 module myself. Its definition is in the xxx-cache.lib file in the folder of the schematics that use it. If you have trouble accessing it I can send you the file separately. These cach.lib files are just simple text files, you can edit them with your favourite text editor (I usually use Mousepad). So if you have a file with your personalised KiCad components in it, you can just copy and paste the definition from the cache.lib file into your own personalised file, and it will be available for your own drawings. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Yes you should be able to use a 5 watt 6 volt solar panel, so long of course as you are using a 6 volt battery.

    Hi David_0519, Your battery voltage readings are consistent with a fully charged or nearly fully charged lead acid battery, and applying a load that will discharge it in about 5 hours. So it is probably normal. What sort of variation in the temperature display do you experience? If it is just the last digit, it may be just instability in the last bit of the ADC reading causing the reading to fluctuate between (say) 29 and 28. The least significant bit of the ADC is worth almost 0.5C, so a small instability can make it appear to jump 1C. If that is all it is, you can if you like put in a bit of code to filter out the noise.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi NorthC2, Yes of course you can leave out the mains supply control sub-circuit. If your panel(s), charger and battery as well as the load are on buoys I guess you need to be careful they don't get wet. That would be my main worry I think. Good luck with it! Keith

    Hi VongsatonC, The reason that I have the Mains supply as well as the solar panel is that I was asked to add it by someone I have been helping. I think that for the majority of situations there will be no mains supply available and that part of the circuit should be simply left out. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi Michele, That 4th TO220 device is the 7805 voltage regulator, that takes in battery voltage (12V) and puts out the regulated 5V supply for the Arduino, ACS712, LEDs etc.Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi sunita patil, I think you need to think carefully about the logic you use to connect and disconnect the mains supply. You can find an example of the sort of hardware connections required in this schematic:https://github.com/farmerkeith/SolarCharger20AmpAs...The bit you need to look at is in the middle part of the diagram. The key components are Q8 and Q9 and the control from Arduino Pin D3 (which can of course be any pin you choose). You can replace the 230V transformer and rectifier with an AC adapter of suitable output voltage and current capacity for your needs. If this is not clear feel free to ask more.

    Hi Ben_21,I think the panel voltage of 0.67 volts is there because of a little bit of reverse leakage current through the NMR2045 diode, and is not a concern. As for the -0.55 Amps of load current showing, and assuming you do not have any load connected, it must be the calibration point of the ACD712 needs adjusting. The ACS712 puts out Vcc/2 on its data pin when the current is zero. This should be 2.5 volts when the Vcc is 5 Volts. The calibration point is set in the software in line 158 (in my copy) which reads "load_current = (read_adc(CURRENT_ADC)*.0488 -25);"The literal value 25 represents the offset current. If you are getting -0.55Amps, and you adjust that literal value to 24.45, you should get a reading of 0 when there is no current. So now the line will read: "l...

    see more »

    Hi Ben_21,I think the panel voltage of 0.67 volts is there because of a little bit of reverse leakage current through the NMR2045 diode, and is not a concern. As for the -0.55 Amps of load current showing, and assuming you do not have any load connected, it must be the calibration point of the ACD712 needs adjusting. The ACS712 puts out Vcc/2 on its data pin when the current is zero. This should be 2.5 volts when the Vcc is 5 Volts. The calibration point is set in the software in line 158 (in my copy) which reads "load_current = (read_adc(CURRENT_ADC)*.0488 -25);"The literal value 25 represents the offset current. If you are getting -0.55Amps, and you adjust that literal value to 24.45, you should get a reading of 0 when there is no current. So now the line will read: "load_current = (read_adc(CURRENT_ADC)*.0488 -24.45);"There are "better" ways to do this, from a software usability perspective, However this is the minimal change that should get you a good result. Please report back if this solves your issues.

    Hi sunita patil, you can find the schematic diagram at the end of Step 2. There is a link there where you can download the pdf. If you have trouble with the link, please ask again.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 2 months ago
    Solar Powered WiFi Weather Station

    Hi johweb, I have not had problems with using deep sleep on various instances of Wemos D1 mini pro. Your problem may be in the particular instance of the Wemos you are using - ie a hardware problem. However I am a bit puzzled by your latest message. You say you have added "Serial.println("pass here!") in the setup() section. My question is do you get this message printed on the serial monitor when the WeMos first starts, but not when it wakes up after deep sleep, when you just get junk characters? One possibility is that the junk characters are disguising the message from your software. I suggest you modify your added statement to include a new line, so it reads:"Serial.println("\npass here!")Good luck,Keith

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 2 months ago
    Solar Powered WiFi Weather Station

    Hi th.deppe. I have not been using the Thingspeak version, but I am sure it is possible to add the Deep Sleep feature to it. Some other users may know it Thingspeak requires a new login at every wake up. Please see my answer to comments below to PitrP with a bit of discussion about the deep sleep options. Also you need to connect the D0 pin to RST on the Wemos board, which is how the sleep timer is able to wake up the processor. If you need more guidance on the details, please reply with your question(s). Keith

    Hi johweb, You are right it is necessary to connect D0 to RST (which I forgot about in my answer to the question under Comments below (from PitrP). Are you using Blynk? If so, it may be that it is taking a long time to re-start the Blynk process. Two suggestions to get started:a) in the setup() section, just after Serial.begin(9600) line, add a new line such as:Serial.println("\n Solar Powered Weather Station");This will tell you whether the software is getting to that point, or getting stuck before that.b) In the early part of the software, there is a line that looks like this:// #define BLYNK_PRINT Serial // debug printing from library enabledJust delete the first two characters (the //) which will make the line active and give you some print outs of how the Blynk connection...

    see more »

    Hi johweb, You are right it is necessary to connect D0 to RST (which I forgot about in my answer to the question under Comments below (from PitrP). Are you using Blynk? If so, it may be that it is taking a long time to re-start the Blynk process. Two suggestions to get started:a) in the setup() section, just after Serial.begin(9600) line, add a new line such as:Serial.println("\n Solar Powered Weather Station");This will tell you whether the software is getting to that point, or getting stuck before that.b) In the early part of the software, there is a line that looks like this:// #define BLYNK_PRINT Serial // debug printing from library enabledJust delete the first two characters (the //) which will make the line active and give you some print outs of how the Blynk connection is proceeding. It seems likely to me that this is where your problem is.Please report back with the results.Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi bipul027, In Step 1, the author specifies battery voltage of 6 or 12 Volts and current of up to 10 Amps. I am a bit doubtful about using it for 10 amps, because the MBR2045 power diode will be dissipating about 10 Watts at that current. I think a more prudent limit for a project that will keep working for a long time would be more like 5 amps. The rated maximum power point voltage of your solar panel has to be about 40% higher than the battery voltage - 17 V for a 12V battery, or 8.5V for a 6 V battery.So, using a limit of 5 Amps and a battery of 12 Volts, your solar panel should be up to 5*17=85 Watts. If you are using a 6V battery, your solar panel can be up to 42.5 Watts. You can probably get away with somewhat higher panel ratings if you live in a climate where perfectly clear da...

    see more »

    Hi bipul027, In Step 1, the author specifies battery voltage of 6 or 12 Volts and current of up to 10 Amps. I am a bit doubtful about using it for 10 amps, because the MBR2045 power diode will be dissipating about 10 Watts at that current. I think a more prudent limit for a project that will keep working for a long time would be more like 5 amps. The rated maximum power point voltage of your solar panel has to be about 40% higher than the battery voltage - 17 V for a 12V battery, or 8.5V for a 6 V battery.So, using a limit of 5 Amps and a battery of 12 Volts, your solar panel should be up to 5*17=85 Watts. If you are using a 6V battery, your solar panel can be up to 42.5 Watts. You can probably get away with somewhat higher panel ratings if you live in a climate where perfectly clear days with bright sunlight are unusual. The storage capacity of your battery can be as high (or as low) as you like. That just determines how long it can supply the load current when the sun is not shining.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 2 months ago
    Solar Powered WiFi Weather Station

    Hi ПреславВ, Yes I am happy to share all that I have on this topic.There are (at least) three levels. "Basic" sleep: To put your WeMos D1 mini Pro to sleep, you use the instructionESP.deepSleep(sleepTime); In this instruction, sleepTime is a long integer in microseconds. You can define the value in a const declaration at the beginning of your code, or just type a number into the instruction. You just put the instruction in your code at the point where you want the microcontroller to go to sleep.For example to sleep for 1 second you type:ESP.deepSleep(1000000); // sleep for 1 secondYou should be aware that when the microcontroller wakes up at the end of sleepTime, it starts from the beginning. It has no memory of what happened before it went to sleep. If you want to carry info...

    see more »

    Hi ПреславВ, Yes I am happy to share all that I have on this topic.There are (at least) three levels. "Basic" sleep: To put your WeMos D1 mini Pro to sleep, you use the instructionESP.deepSleep(sleepTime); In this instruction, sleepTime is a long integer in microseconds. You can define the value in a const declaration at the beginning of your code, or just type a number into the instruction. You just put the instruction in your code at the point where you want the microcontroller to go to sleep.For example to sleep for 1 second you type:ESP.deepSleep(1000000); // sleep for 1 secondYou should be aware that when the microcontroller wakes up at the end of sleepTime, it starts from the beginning. It has no memory of what happened before it went to sleep. If you want to carry information from one cycle to the next, you need "Advanced" sleep (the last one I mention below)."Improved" sleep: the instruction is the same, but what I do is a bit of arithmetic to make the wake times line up with a given period. Like this:// declaration before setup() section:const long reportingTime=60000 ; // 60 seconds in milliseconds// code at the point of going to sleep:long sleepTime = reportingTime - millis(); // in milliseconds if (sleepTime <1000) sleepTime = 1000; // set minimum sleep of 1 secondESP.deepSleep(sleepTime * 1000); // convert to microseconds With this code, the period of the sleep (sleepTime) is reduced by the awake time, so that the total of sleep and awake stays the same, provided awake time is not longer than the reportingTime value. Using Blynk, the microcontroller has to log in to Blynk every time it wakes up. This time is variable, which is why adjusting the sleep time becomes relevant if you want a fixed reporting interval."Advanced" sleep You can use "Improved" sleep as above, together with some way of storing data while the ESP8266 is asleep. Various possibilities are explained in my Instructable on the BMP280, which you can find at https://www.instructables.com/id/Library-for-BMP280As an example, I put the code for 2 functions into my sketches as follows:void saveCounter(byte counter){ // write value of counter into bmp1 bmp1.updateF4ControlSleep(counter&0x3F); // store counter bmp1.updateF5ConfigSleep((counter/64)&0x3F); // store counter} Calling this function just before going to sleep saves the value of counter in the BMP280 memory.byte recoverCounter(){ // read value of counter back from bmp1 byte bmp1F4value= bmp1.readF4Sleep(); // 0 to 63 byte bmp1F5value= bmp1.readF5Sleep(); // 0 to 63 return bmp1F5value*64+bmp1F4value; // 0 to 4095} Calling this function in setup() recovers the value of counter from the BMP280 memory.To make these work, you need the BMP280 library that I have written. There is a link in the Instructable (as well as a lot more explanation) and also here:https://github.com/farmerkeith/BMP280-libraryBack to your original question: How to do a 10 minute sleep?// declaration before setup() section:const long reportingTime=60000 * 10 ; // 10 minutes in milliseconds// code at the point of going to sleep:long sleepTime = reportingTime - millis(); // in millisecondsif (sleepTime <1000) sleepTime = 1000; // set minimum sleep of 1 secondESP.deepSleep(sleepTime * 1000); // convert to microseconds

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi Michele,The 3 TO220 packages you can see in your photo are 2 MOSFETs and 1 diode (the MBR2045, D1 in the schematic). Physically the diode looks the same as a MOSFET - it even has 3 leads, because this part is actually MBR2045CT which means it is 2 diodes in the same package. See Step 15.This circuit is designed for either a 6 volt or 12 volt lead acid battery. It can be adapted to other voltages, but not as low as 3.7 Volts. If you want to charge a 3.7V Lithium battery, I suggest the best way is to build the circuit for either 6 or 12 volts, and add an additional battery charging circuit for your Lithium battery. I think the best way is to use a small buck converter which you can adjust for an output of around 4.5 volts or so, and a TP4096 Lithium battery charging board. Or you can c...

    see more »

    Hi Michele,The 3 TO220 packages you can see in your photo are 2 MOSFETs and 1 diode (the MBR2045, D1 in the schematic). Physically the diode looks the same as a MOSFET - it even has 3 leads, because this part is actually MBR2045CT which means it is 2 diodes in the same package. See Step 15.This circuit is designed for either a 6 volt or 12 volt lead acid battery. It can be adapted to other voltages, but not as low as 3.7 Volts. If you want to charge a 3.7V Lithium battery, I suggest the best way is to build the circuit for either 6 or 12 volts, and add an additional battery charging circuit for your Lithium battery. I think the best way is to use a small buck converter which you can adjust for an output of around 4.5 volts or so, and a TP4096 Lithium battery charging board. Or you can connect a small solar panel directly to the TP4096 charging board. See this Instructable for how to go about this. https://www.instructables.com/id/Solar-Powered-WiF...Of course these suggestions are only appropriate for small size Lithium batteries - like AA or 18650 size. If you have a very large 3.7 Volt battery, you will need a different solution, but you still cannot use this PWM charging circuit directly because 3.7 volts is not enough to turn on the charging MOSFET.Keith

    View Instructable »
  • farmerkeith commented on farmerkeith's instructable Controlling DC Converter Modules2 months ago
    Controlling DC Converter Modules

    I know the control works with PWM applied to the feedback pin. The exact mechanism is a bit unclear to me. I think the sawtooth from the oscillator must have a larger aplitude than the swing of the first op amp. Maybe the response time of the first op amp is rather long, so that it effectively averages out the input PWM signal. Because these op amps are internal to the XL4016 device, it is not possible to do any observations on these signals. The pot must not be disconnected from the feedback pin, otherwise there is no control over the output voltage. If you are able to do some testing that throws light on how this works in detail, I will be happy to include the information in an update of this instructable.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi mgbena0007, I suggest you have a look at the zopinter comment above re his XL4016 based solution. Also have a look at the SZBK07 module and this design that uses it: https://github.com/farmerkeith/SolarChargerSZBK07...If you can use a 24V battery and if you can figure out a way to combine 4 SZBK07 modules, you can get to 2 kW.

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi tytower, the purpose of measuring the battery voltage is to decide the charging rate, so as to avoid overcharging. The battery voltage rises when under charge, but that does not invalidate the decision making process.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi dhv007, your method of parallelling the capacitors and MOSFETs is correct. However you should be aware there are some problems with the circuit. a) the reverse current flow prevention does not work because some part of the battery voltage gets through the the gate of Q1 (Q1 and Q1*2 in your circuit). I think the easiest way to solve this is to replace that part of the circuit with a MOSFET diode. You can find information on that at my Github repository https://github.com/farmerkeith/circuits/blob/maste... You won't need to double this component for panel currents under 8 amps.There are other solutions of course if you don't want to change MOSFET type. You can find one at https://github.com/farmerkeith/SolarChargerTwoAmp...b) when you double the switching MOSFETs, gate capacitance al...

    see more »

    Hi dhv007, your method of parallelling the capacitors and MOSFETs is correct. However you should be aware there are some problems with the circuit. a) the reverse current flow prevention does not work because some part of the battery voltage gets through the the gate of Q1 (Q1 and Q1*2 in your circuit). I think the easiest way to solve this is to replace that part of the circuit with a MOSFET diode. You can find information on that at my Github repository https://github.com/farmerkeith/circuits/blob/maste... You won't need to double this component for panel currents under 8 amps.There are other solutions of course if you don't want to change MOSFET type. You can find one at https://github.com/farmerkeith/SolarChargerTwoAmp...b) when you double the switching MOSFETs, gate capacitance also doubles which means that the switching time doubles unless you do something about it. In this circuit using the IR2104 driver the switching speed is already a problem. My suggestion is that you use a different driver, IR2184 which has a much higher drive current capacity; and also that you use two of them, one for Q2 and Q3, and the other one for Q2*2 and Q3*2.You should be aware that although the functionality of IR2184 is the same as IR2104, the pinout is different so you need to change your wiring plan or PCB.You can drive the two IN pins and two SD\ pins together, each through its own resistor, from the same output pin on the Arduino. c) I also recommend you move the SD pin from D8 to D10 on the Arduino. That is because with D10 it is possible to do PWM co-ordinated with D9. It is a long story and beyond what can explain here; but it is relatively easy to change early in the process, much harder later.d) I notice that you are connecting Vcc of your driver IC (IR2104 or IR2184) to the panel voltage. You can expect that to exceed the voltage rating of the driver, which has a maximum Vcc of 20 Volts. You should connect it to the battery voltage, which will not go over 15 Volts - or if it will you need to create a 12 volt or so supply for the driver IC. e) one of the main limitations in this circuit is the inductor. According to my modelling it has a temperature rise of 54 C at a current of 5 Amps.If you are interested in higher capacity solar chargers, I suggest you have a look at some other designs that use commercial DC-DC converters. https://github.com/farmerkeith/SolarChargerSZBK07M...https://github.com/farmerkeith/Solar-charger-XL401...Good luck and happy Making. .Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hello NorthC2, There is not really any V3.1 project to follow. If you want something that actually works right now, please look at the comments from zopinter and all the replies to it.The original schematics were created using Eagle. I am now using KiCad for my schematics.

    Hi pawel2357, the charging process for a LiFePO4 battery is a bit different than a lead acid battery. The usual process is first constant current until the battery hits 4.1 volts/cell, and then constant voltage at 4.1 volts. There may also be a need for cell balancing, to make sure the voltage in each cell never goes over 4.1 volts.

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi TeddyGG, I am sorry to hear you have some problems. I don't know for sure but I think it is likely that the little buck converter (just to the right of the Nano) is responsible for your measurement of 68 K instead of 100 K. Another possibility is that, with the Nano removed from its socket, that the D2 and D3 pins are floating and may get a little bit of current from thermal noise and allow a few electrons to flow through R6 and/or R8. I don't think this is your main problem. It is not really possible to check your connections from the photos, even though they are quite clear. I think you need to do the following:a) check your wiring with a multimeter to make sure that nothing is shorted to ground that should not be. b) with the Arduino Nano out of its socket and the ACS712 disconnec...

    see more »

    Hi TeddyGG, I am sorry to hear you have some problems. I don't know for sure but I think it is likely that the little buck converter (just to the right of the Nano) is responsible for your measurement of 68 K instead of 100 K. Another possibility is that, with the Nano removed from its socket, that the D2 and D3 pins are floating and may get a little bit of current from thermal noise and allow a few electrons to flow through R6 and/or R8. I don't think this is your main problem. It is not really possible to check your connections from the photos, even though they are quite clear. I think you need to do the following:a) check your wiring with a multimeter to make sure that nothing is shorted to ground that should not be. b) with the Arduino Nano out of its socket and the ACS712 disconnected, connect the batery to the battery terminals and check that its 12V appears in the right places. Also check that the buck converter is putting out 5V, and adjust it if not. It may be worth while also pulling out the fuses, checking the voltages on the fuse terminals, then replacing the fuses. c) you can also check the functioning of transistor T2 by connecting the driver terminal D2 to ground (to turn the transistor off) and +5V (to turn the transistor on). If you have a 12V light bulb you can connect to the load terminals that may help your testing. d) if all the above tests are OK, it should be safe to put in a working ACS712. e) if that is all OK, you should measure the voltages on all the Arduino pins, to make sure they make sense. Then you should be OK to put in your (working) Arduino. I hope you can find the problem.

    View Instructable »
  • farmerkeith's instructable Controlling DC Converter Modules's weekly stats: 3 months ago
    • Controlling DC Converter Modules
      201 views
      10 favorites
      0 comments
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi victory282,I understand you want to calculate and display on the LCD the estimated time to the battery being fully charged (when it is being charged) and the estimated time to the battery being fully discharged (when it is being discharged). These things are possible, at least as an approximation, but are not just a matter of software.Hardware: In the schematic v2.0 the current meter module (ACS712) is in the path between the load control MOSFET and the output fuse. In this position it can measure the load (discharge) current but not the charging current. This means that you can get an estimate of discharge time to empty, but not charge time to full. Either you have to add a second current meter module to measure the charging current, or move the existing one into the path to and fro...

    see more »

    Hi victory282,I understand you want to calculate and display on the LCD the estimated time to the battery being fully charged (when it is being charged) and the estimated time to the battery being fully discharged (when it is being discharged). These things are possible, at least as an approximation, but are not just a matter of software.Hardware: In the schematic v2.0 the current meter module (ACS712) is in the path between the load control MOSFET and the output fuse. In this position it can measure the load (discharge) current but not the charging current. This means that you can get an estimate of discharge time to empty, but not charge time to full. Either you have to add a second current meter module to measure the charging current, or move the existing one into the path to and from the battery. If you move it to this position, it can give you positive current for charging, or negative current for discharging. That seems to me to be the best approach. Software: Quite a few things need to be added. You need a function that calculates battery state of charge (SOC) based on the battery voltage and the current into or out of the battery. Then you need a constant for the capacity of the battery in amp-hours (AH), and (probably) a SOC value that you will consider to be "fully discharged". This is because if you discharge thte battery below about 30% SOC it is likely to affect its life, so you could consider something like the 30% discharge point as being fully discharged. This is a matter of how you want to use the displayed value. Given these things, the time to full charge when charging is (100%-SOC%)*AH/100/Current (result in hours)Similarly, the time to full discharge when discharging is(SOC%-30%)*AH/100/(-Current) (result in hours)Finally, you need to figure out what the LCD display should look like. The existing software uses all the spaces on the display, so you will need to give up something, or alternate between different display modes. If you want to alternate, you could do it using a timer, or you could add a button to switch between the alternatives (another hardware change). I hope this gives you an idea of what is involved. If you want to do it, I can give you support with any problems you may encounter. Please let me know what you decide to do.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi, I received 2 of these modules in the mail a couple of days ago. These modules. coded SZBK07 and rated at 20 Amps, are slightly different to control than the XL4016 8 amp modules. I wrote an Instructable to explain how to do it. You can find it here:https://www.instructables.com/id/Controlling-DC-Co...

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi ashks, It should work with a Uno. I think there is some connection problem with your ACS712 for measuring the load current. Use your multimeter to check that you have +5v and Ground connected to the correct pins on the ACS712. Then check that you have 2.5V on the data pin, and also on pin A2 of your Uno.

    Hi victory282, I find your question a bit hard to understand. The answer will depend on exactly what you want to do. In the software you will see there are calculations of amp hours and watt hours, and the watt hours are displayed on the LCD and also on the serial monitor when connected. Can you clarify what you want to display, and where?

    View Instructable »
  • 1602 LCD Keypad Shield Module With I2C Backpack

    Hi Sara_6, We are progressing but slowly. The link to your lcd keypad module has a photo that clearly shows it is the DFRobot module. Hence I think the button values will be the same as mine. The photo of your real time clock module shows that it is NOT a DS1307, but is a DS1302. This runs a different protocol than the DS1307, and is not I2C. We will have to use different pins for this module, and different software. I found a link to a site that probably will provide a solution, here:https://playground.arduino.cc/Main/DS1302I have not tried it, because i don't have a DS1302 module. I think you should connect your module to some spare pins on your Uno, download his software and try it as is. The compilation error you have been getting - I get it also when I use MenuBackend.h version 1.6...

    see more »

    Hi Sara_6, We are progressing but slowly. The link to your lcd keypad module has a photo that clearly shows it is the DFRobot module. Hence I think the button values will be the same as mine. The photo of your real time clock module shows that it is NOT a DS1307, but is a DS1302. This runs a different protocol than the DS1307, and is not I2C. We will have to use different pins for this module, and different software. I found a link to a site that probably will provide a solution, here:https://playground.arduino.cc/Main/DS1302I have not tried it, because i don't have a DS1302 module. I think you should connect your module to some spare pins on your Uno, download his software and try it as is. The compilation error you have been getting - I get it also when I use MenuBackend.h version 1.6 (which is the one you sent me). It does not occur with MenuBackend.h version 1.5. I am attaching that so you can use it. This is not a very satisfactory situation, because usually a later version of a library should not make earlier code fail. However we can proceed with Version 1.5 at least for the moment.I am also attaching an updated version of your software. It includes changes that I think will work for you. There are some lines with comments that say "//works for KH" and the next line says "//works for Sara". I have commented out the KH lines and left in the Sara lines. You may need to swap some of them around. If you open it up and load it to your Uno with the serial monitor running you should be able to see the results of button presses on the serial monitor, and at least some of them will show up on the LCD screen. Maybe you can figure out if it is doing what you want. If it is OK as it is, the main job remaining will be to get the DS1302 going (as per suggestions above). Good luck,Keith

    Sara_6, this is not your parts list. Instead of Sparkfun Real Time Module (1x) it should say DS1302 real time moduleInstead of LCD Keypad Shield (1x) it should say DFRobot LCD Keypad shield.I suspect that the item that says i2c actually means I2C serial backpack for LCD module. By itself, i2c is meaningless.Being specific about the parts you are using helps a lot in working out how to help you. Keith

    Hi Sara_6, I am not sure about whether you want to change the LCD to serial, or leave it directly connected. Either way is possible and I think I have given you the information you need to do either. The only other thing I found was that on my version of the LCD keypad (which the DFRobot type) I had to change the threshold values for key recognition. The adjusted code, with relevant comments, is copied below here. if (adc_key_in > 1000) return btnNONE; if (adc_key_in < 50) return btnRIGHT; // was 50; R button returns 0 if (adc_key_in < 180) return btnUP; // was 250; U button returns 100 if (adc_key_in < 333) return btnDOWN; // was 450; D button returns 257 if (adc_key_in < 524) return btnLEFT; // was 650; L button returns 410 if (adc_key_in < 820) return btnSE...

    see more »

    Hi Sara_6, I am not sure about whether you want to change the LCD to serial, or leave it directly connected. Either way is possible and I think I have given you the information you need to do either. The only other thing I found was that on my version of the LCD keypad (which the DFRobot type) I had to change the threshold values for key recognition. The adjusted code, with relevant comments, is copied below here. if (adc_key_in > 1000) return btnNONE; if (adc_key_in < 50) return btnRIGHT; // was 50; R button returns 0 if (adc_key_in < 180) return btnUP; // was 250; U button returns 100 if (adc_key_in < 333) return btnDOWN; // was 450; D button returns 257 if (adc_key_in < 524) return btnLEFT; // was 650; L button returns 410 if (adc_key_in < 820) return btnSELECT; // was 850; S button returns 639 return btnNONE;The other change that you said you wanted to do was to add a buzzer. I think you should get the basic unit working on the existing code first, and then add the buzzer afterwards. Adding the buzzer will be quite simple if you know what you want it to do. Please let me know how you get on.Keith

    View Instructable »
  • 1602 LCD Keypad Shield Module With I2C Backpack

    Hi Sara_6, With your software which I have changed a little bit, I now have the LCD displaying "Take 1 pill(s)" on line 1 and "every 1 hours" on line 2. Progress. The changes I made to your software are:in the "includes" section, add#include <LCD.h>#include <LiquidCrystal_I2C.h>and delete #include <LiquidCrystal.h>This is because you need the library for the LCd that accesses it via I2C.Not far below that, replace LiquidCrystal lcd(8, 9, 4, 5, 6, 7);with LiquidCrystal_I2C lcd(0x27, 2,1,0, 4, 5, 6, 7);This is to tell the I2C library the address and what pins to use.Also (this is not essential but it helps) just after the lineSerial.begin(9600); add a new lineSerial.println("\n Starting pillReminder ");Can you please tell me the ex...

    see more »

    Hi Sara_6, With your software which I have changed a little bit, I now have the LCD displaying "Take 1 pill(s)" on line 1 and "every 1 hours" on line 2. Progress. The changes I made to your software are:in the "includes" section, add#include <LCD.h>#include <LiquidCrystal_I2C.h>and delete #include <LiquidCrystal.h>This is because you need the library for the LCd that accesses it via I2C.Not far below that, replace LiquidCrystal lcd(8, 9, 4, 5, 6, 7);with LiquidCrystal_I2C lcd(0x27, 2,1,0, 4, 5, 6, 7);This is to tell the I2C library the address and what pins to use.Also (this is not essential but it helps) just after the lineSerial.begin(9600); add a new lineSerial.println("\n Starting pillReminder ");Can you please tell me the exact modules that you are using?In particular, are using the DFRobot keypad LCD or the Sainsmart one?Are you using the Sparkfun real time clock module, or the TinyRTC module?Which Arduino board are you using (I am using a Nano)?Please let me know how you go with these suggestions.Keith

    Hi Sara_6, I had another look at this. I found a solution on the internet that allowed me to compile the example. The errors I get with your code is just one, which appears twice. It is on line 103 and line 431 of your code, where the code says "menu.toRoot();" which the compiler rejects since there is no "toRoot" in the class definition, or anywhere else in the MenuBackend.h file. Did you copy this from somewhere? Do you know what it is supposed to achieve? Keith

    Hi Sara_6, I realised soon after I sent this that you don't need any of these last changes. I think you are using direct connection between your Arduino and the LCD keypad unit. So you don't need the serial library after all. I had assumed that you were using serial, because that is what this Instructable is mainly about. I am looking forward to your answers to my questions still. Keith

    Hi Sara_6, I think we are making progress. I can now get your software to compile. To achieve this, you need to add a couple of lines to the Version 1.4 MenuBackend.h library. It is quite simple. Find the MenuBackend.h file and open it in a text editor such as Mousepad. It should be version 1.4 (the version number is in line 4). Go to line 195, and just before the line that says private: add the following:void toRoot(){ setCurrent(&getRoot()); }Then save the file. Once you have done that, your software should compile without errors. After that, you can start working on making it do what you want it to do.

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi KaustubK, there is no Printed Circuit Board (PCB) for this project. It is built on a prototype circuit board, which you can see in the photos - eg Step 24 shows how the components are arranged on the board.

    Hello ramones1995, You may have more than one problem, and the photos are not very clear. First I think you need to check the connections carefully against the circuit diagram. The high battery voltage reading you see on the LCD (16.10V) may be due to the voltage divider resistors being different from the 100K and 20 K specified. For example if the divider you have used is 100K and 30K it would explain what you are seeing. You can adjust the value in the software. It is on line 157, where it saysbat_volt = read_adc(BAT_ADC)*0.00488*(120/20);You can change the 120/20 to (say) 130/30 and see if the LCD becomes the same as your multimeter. Try different numbers until the multimeter and the LCD show the same value. As for the 2 to 5 volts you see on the LCD with "nothing" connec...

    see more »

    Hello ramones1995, You may have more than one problem, and the photos are not very clear. First I think you need to check the connections carefully against the circuit diagram. The high battery voltage reading you see on the LCD (16.10V) may be due to the voltage divider resistors being different from the 100K and 20 K specified. For example if the divider you have used is 100K and 30K it would explain what you are seeing. You can adjust the value in the software. It is on line 157, where it saysbat_volt = read_adc(BAT_ADC)*0.00488*(120/20);You can change the 120/20 to (say) 130/30 and see if the LCD becomes the same as your multimeter. Try different numbers until the multimeter and the LCD show the same value. As for the 2 to 5 volts you see on the LCD with "nothing" connected (is that correct?) I think you must have your Arduino Nano connected to the USB on your computer, in which case 5V from the USB goes to the BAT+ terminal and from there goes through the body diode of Q1, which explains the battery voltage reading on the LCD. Diode D1 should stop that getting to the panel voltage divider, but you are seeing the same reading there. Is it possible you have the diode installe back to front? Please check.

    Hi av1483110, your comment is a bit puzzling. In the circuit there are 2 MOSFETs IRF9504 and one power diode MBR2045. They all have a function, which I can explain if that is your question.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 4 months ago
    Solar Powered WiFi Weather Station

    Hi mauber, I think that the only real solution is to separate the solar panel and the temperature sensor physically. For example, put the solar panel away from the enclosure, connected by wires. If you just put the complete enclosure, with solar panel, in a shady place, you may get enough light to charge the battery provided you have the sleep time long enough.

    Hi JohnG591, Yes you are missing the library wire.h. Normally it is included by default in your IDE, but there is a different version needed for the ESP8266 which you can get from here:https://github.com/esp8266/Arduino

    View Instructable »
  • 1602 LCD Keypad Shield Module With I2C Backpack

    I found another version of MenuBackend.h at http://www.arduino.cc/playground/uploads/Profiles/...At least it compiles as a valid library, but neither the example nor your sketch will compile with it. They both fail with errors. So I think help is still needed from the experts on this menu management system.

    Hi Sara_6, I am glad to hear that your LCD problem is solved and it now works. I put your software into an Arduino sketch and pressed the button for verify. It returns "Error compiling for board Arduino Nano" and (among other things, and after copying in MenuBackend.h from github) "Invalid library found in ... /Arduino/libraries/Wiring:" So I think your problem is with using that library. It is new to me, I have not used Wiring. I think your options are to use some other pathway to achieve your programming goals; or seek help from the Wiring community who may be able to give you guidance on getting this library installed and working.If you want to go forward without using the Wiring framework, I expect I can help you with any problems you may encounter.I am sorry I...

    see more »

    Hi Sara_6, I am glad to hear that your LCD problem is solved and it now works. I put your software into an Arduino sketch and pressed the button for verify. It returns "Error compiling for board Arduino Nano" and (among other things, and after copying in MenuBackend.h from github) "Invalid library found in ... /Arduino/libraries/Wiring:" So I think your problem is with using that library. It is new to me, I have not used Wiring. I think your options are to use some other pathway to achieve your programming goals; or seek help from the Wiring community who may be able to give you guidance on getting this library installed and working.If you want to go forward without using the Wiring framework, I expect I can help you with any problems you may encounter.I am sorry I can't be more help. Keith

    View Instructable »
  • 1602 LCD Keypad Shield Module With I2C Backpack

    Hi Sara_6,Have you tried adjusting the contrast pot on the DFRobot LCD shield? It is a multi-turn pot at the top left corner of the shield. Try winding it clockwise for several turns (up to 10) and see if you start to see the pixels on the LCD display. Please let me know if that solves your problem. Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi محمدح25 , It looks to me as if the current sensor ACS712 is not connected properly. I suggest you check whether the +5V and GND are there (measure the voltages with your multimeter) and also whether there is 2.5V on pin A2 of your Arduino when there is no current flowing.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 4 months ago
    Solar Powered WiFi Weather Station

    Hi JohnG591, I believe you need to install the Wire library. In your Arduino IDE, in the sketch menu click on Include Library then Manage Libraries. You can get the version for the ESP82666 here: https://github.com/esp8266/Arduino/tree/master/lib...

    Hi Flexomat, I think you need to figure out where the problem is. Two suggestions to get started:a) in the setup() section, just after Serial.begin(9600) line, add a new line such as:Serial.println("\n Solar Powered Weather Station");This will tell you whether the software is getting to that point, or getting stuck before that. b) In the early part of the software, there is a line that looks like this:// #define BLYNK_PRINT Serial // debug printing from library enabledJust delete the first two characters (the //) which will make the line active and give you some print outs of how the Blynk connection is proceeding. It seems likely to me that this is where your problem is. Please report back with the results. Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Yes of course I will share any information that I find. I have ordered 2, due to arrive early May 2018.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Yes I agree these look promising. Do you have any more information about them? Presumably the control of output voltage will be similar to the XL4016 module.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    This is an addition to my comment A) above, about shorting out the current sense resistor. I was wrong to say "Shorting out that resistor has the effect of disabling the current limit protection built into the buck converter, so its current can increase to the limit of capacity of the supply (solar panel) depending on the PWM settings." The XL4016 has the current limiting function internally. Shorting out that resistor only disables the current regulation fuction of the buck converter module, which enables the current limit to be controlled by a pot. The 8Amp limit, as well as the thermal protection, will still work even if that current sense resistor is shorted.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi AndreasT33, I think the main difference is that the Due is a 3.3 Volt microcontroller, so you need a feed resistor with a lower value than for the 5V controllers. For example, in my posting a few days ago, I calculated the feed resistor for a maximum of 15 Volts (set by the pot) and 10V (with 100% PWM) which gave 2572 Ohms for a 5 Volt controller, If the controller is 3.3Volt, that resistor would need to be 1226 Ohms. zopinter has answered the other parts of your question.

    Thanks Zoltan. I was struggling a bit to understand the current limiting function of the coverter using the schematic diagram above. It seemed there were some connections missing. Then I discovered the attached schematic, which supplies the missing information, and makes the current limiting work. FYI.I got it from http://www.cientificosaficionados.com/foros/viewto...Thank you to them.Keith

    Hi Zoltan, a few points here. A) from a functional point of view, there is no need to short out the current sense resistor on the buck converter. Shorting it out WILL increase the efficiency, since (eg) at 8 Amps it will dissipate 0.64 Watts, out of a total loss of about 8 Watts. Leaving the resistor in place effectively increases the output impedance of the buck converter by 0.01 Ohms, but really has no other effect. The voltage measured at the battery will still be the battery voltage. Shorting out that resistor has the effect of disabling the current limit protection built into the buck converter, so its current can increase to the limit of capacity of the supply (solar panel) depending on the PWM settings. Especially for anyone using a high capacity solar panel, I would recommend le...

    see more »

    Hi Zoltan, a few points here. A) from a functional point of view, there is no need to short out the current sense resistor on the buck converter. Shorting it out WILL increase the efficiency, since (eg) at 8 Amps it will dissipate 0.64 Watts, out of a total loss of about 8 Watts. Leaving the resistor in place effectively increases the output impedance of the buck converter by 0.01 Ohms, but really has no other effect. The voltage measured at the battery will still be the battery voltage. Shorting out that resistor has the effect of disabling the current limit protection built into the buck converter, so its current can increase to the limit of capacity of the supply (solar panel) depending on the PWM settings. Especially for anyone using a high capacity solar panel, I would recommend leaving the current sense resistor in the circuit.B) about the switching circuit using 2 MOSFETs and a bipolar transistor. As you say, this can be used to control the output of the buck converter using a PWM signal on the resistor to the base of the transistor. However the circuit as drawn has a few issues:B1) the MOSFETS are type ZXM61P03F which have a reverse breakdown voltage of 30V and a rated current capacity of 1.1 Amps. That rating is well below the capability of the XL4016 buck converter, so different MOSFETs may be needed in practice. B2) Thie circuit has a fast turn-on, slow turn-off characteristic, since the transistor when it turns on will rapidly charge the gate capacitance of the 2 MOSFETs, but their discharge when the transistor turns off will be acording to the RC time constant of the 2 MOSFETs in parallel and the 470K gate resistor. Wth the ZXM61P03F MOSFETs, which have an input capacitance of 140 pF (each) this gives a time constant of about 130 microseconds. With other more capable MOSFETs it can be expected to be slower. If the PWM frequency is about 1 kHz (as for the default AnalogWrite in the Arduino world) even if the microcontroller is set to a low duty cycle (say 1%) the minimum duty cycle will be of the order of 13% (130us / 1000 us). So you really cannot achieve very low current flow, as you can with the PWM control of the ZX4016 SB pin. B3) This circuit does not prevent reverse current flow except when fully OFF. As you pointed out earlier, the XL4016 may be damaged by applying battery voltage to its output with nothing on the input. Hence it becomes a software responsibility to keep it turned off until there is enough voltage on the solar panel side.B4) putting points B1 and B2 above together, to make a circuit that matches the capability of the XL4016 buck converter, we can use MOSFETs type IRF9540 ("13 Amps") or IRF4905 ("50 Amps"). The IRF9540 has an input capacitance of 1400 pf, so the gate resistor in the circuit needs to be reduced to 47 K ohms to get the same performance. The IRF4905 has an input capacitance of 3400 pF, so the resistor has to go down to 20 K ohms for the same performance. Other options are slowing the PWM frequency and/or adding an active pull-up circuit for the MOSFET gates. B5) Yet another option is to separate the control of the 2 MOSFET gates, so that one (on the left in the diagram) acts as a diode, and the other (on the right in the diagram) is controlled by the PWM from the microcontroller. This would have the effect of halving the RC time constant at its gate (a good thing) and ensuring the current can never flow backwards into the buck converter. The disadvantage is that it makes the circuit more complicated. Regards,Keith

    View Instructable »
  • ARDUINO SOLAR CHARGE CONTROLLER ( Version 2.0)

    Hi PrakashC19, I have had a good look at your photos. It is a bit hard to be sure, but I suspect there are some wrong connections. Also you say in your message "first power mosfet (MBR9540)". The connection from the solar panel goes from the fuse, to the power diode MBR2045, and then to the mosfet IRF9540. There is no such thing as MBR9540. From the fuse the connection goes to the MBR2045 pins 1 and 3. Then from the MBR2045 pin 2 the connection goes to Pin 3 of the IRF9540. Looking at the IRF9540 with the tab to the back, the source is the right-most pin. The collector of T1 goes to the Gate, which is the left-most pin of the IRF9540. I hope this helps. Good luck. Please post again with results of your checking.

    Hi KentG26, The charger should work with a windmill just the same as for a solar panel.

    Hi skyler78, The most likely hypothesis I can offer is that you have put your IRF9540 in back to front, with source and drain reversed. Please check it carefully against the data sheet. However even this may not explain what you are seeing.If you look at the circuit diagram, the connection from the solar panel comes through the fuse and D1 to the Source of Q1. Resistor R6 holds the Gate of Q1 at the same voltage as the Source, unless the bipolar transistor T1 is turned on. So with T1 off, Q1 will be off. Then the Arduino turns T1 on, its collector voltage goes to ground (nearly) and so does the gate of Q1, which then is negative with respect to the positive voltage on its Source, so it turns ON. To answer your questions directly (that is, the question: Why is that we use a PMOS? Can we ...

    see more »

    Hi skyler78, The most likely hypothesis I can offer is that you have put your IRF9540 in back to front, with source and drain reversed. Please check it carefully against the data sheet. However even this may not explain what you are seeing.If you look at the circuit diagram, the connection from the solar panel comes through the fuse and D1 to the Source of Q1. Resistor R6 holds the Gate of Q1 at the same voltage as the Source, unless the bipolar transistor T1 is turned on. So with T1 off, Q1 will be off. Then the Arduino turns T1 on, its collector voltage goes to ground (nearly) and so does the gate of Q1, which then is negative with respect to the positive voltage on its Source, so it turns ON. To answer your questions directly (that is, the question: Why is that we use a PMOS? Can we not just use an NMOS ...?) the answer is to do with the polarity of the gate voltage relative to the source of the MOSFET. With a P-channel MOSFET, and the Source connected to the solar panel voltage, it can be turned ON by bringing its Gate voltage to ground. If we had an N-channel MOSFET and the same Source connection, to turn it on we would need to raise its Gate voltage to a value higher than the solar panel voltage. This can be done but it usually involves a charge pump of some sort, to generate the above-solar-voltage. The circuit gets a lot more compliated, so using a P-channel MOSFET is simpler. Good luck with the project and please report back, espeially if you continue to have problems.

    View Instructable »
  • farmerkeith commented on deba168's instructable Solar Powered WiFi Weather Station 4 months ago
    Solar Powered WiFi Weather Station

    Hi allesreiniger, I do not think it is useful to add a DC-DC step down between the solar panel and the TP4056. I think you need to check the voltage on your battery both in full sun and in shade. If the battery is working well, it should be at least 3.7V. On my implementation, I am using Blynk and sleep mode with the WeMos waking up every 10 minutes to send a report, and then going badk to sleep. The WeMos is reporting the battery voltage as well as the temperature and pressure. The battery voltage rises to a maximum of 4.1 Volts during the morning, then drops over night to a minimum up 3.8V. If the sleep part of the cycle is too short, the battery discharges too much, the panel cannot recharge it during the day, and the battery is likely to fail.

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    (Previous post continued)The previous equation for total current can be solved for Vout with given values of R11, R21 and pwm. It becomesVout= 1.25 + 3.48mA * R11 – 3.25V * R11/R21 * pwm/255 (for pwm < pwm limit)Here is a chart that shows the behaviour of Vout with R11 set to 10K and R21 of 150 and 935 Ohms. Also a second chart with R11 set to 5K and R21 of 150 and 1000 OhmsIt can be seen that the useful range of pwm values us quite limited. When charging a 12V battery, the charging voltage should never be above 15Volts, nor below 10Volts. Therefore R11 could be adjusted to give a maximum Vout of 15 Volts, and then R21 chosen to give a minimum Vout of 10 volts. Putting numbers to this, Vout max= 1.25 + 3.475mA * R11For Vout max = 15V, R11 = (15-1.25)/3.475 = 3956 Ohms, set by...

    see more »

    (Previous post continued)The previous equation for total current can be solved for Vout with given values of R11, R21 and pwm. It becomesVout= 1.25 + 3.48mA * R11 – 3.25V * R11/R21 * pwm/255 (for pwm < pwm limit)Here is a chart that shows the behaviour of Vout with R11 set to 10K and R21 of 150 and 935 Ohms. Also a second chart with R11 set to 5K and R21 of 150 and 1000 OhmsIt can be seen that the useful range of pwm values us quite limited. When charging a 12V battery, the charging voltage should never be above 15Volts, nor below 10Volts. Therefore R11 could be adjusted to give a maximum Vout of 15 Volts, and then R21 chosen to give a minimum Vout of 10 volts. Putting numbers to this, Vout max= 1.25 + 3.475mA * R11For Vout max = 15V, R11 = (15-1.25)/3.475 = 3956 Ohms, set by adjusting the pot with pwm=0 until Vout = 15VNow we can calculate R21 needed to get Vout=10V.For Vout=10V, current in R11 will be (10-1.25)/R11 = 2.212 mA.The remainder of the 3.475 mA required is in R21, so its current is 1.263 mA. Value of R21 = (5-1.25-0.5)/required current = 2572 Ohms. With these values we can chart the response to pwm:As you can see this gives us a gentler slope and smaller voltage steps for each pwm change. Whether this makes a practical difference is unclear to me. It should mean that the excursions around the maximum power point of the panel should be smaller than if each pwm step has a larger voltage change.I think this is getting me closer to understanding how this charger works. Regards,Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Thanks Zoltan. That clarifies quite a few things. Putting the LTC4412 on the battery side of the buck converter means it is not subject to the solar panel voltage, which could easily exceed its voltage rating. Your sketch schematic does not identify the MOSFET you are using. I guess an IRF4905 or similar would be suitable. Do you have an estimate of the resistance of the two resistors (one fixed, one variable) on the buck converter? AND what are the upper and lower output voltage limits you get with the 1N5819 and 150 ohm resistor to the feedback pin? Thanks,Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Thanks for quick reply Zoltan. Regards.Keith

    View Instructable »
  • ARDUINO MPPT SOLAR CHARGE CONTROLLER (Version-3.0)

    Hi zopinter, can you please clarify about the PWM input that controls the buck converter you got from Ebay. There are several vendors for these, they all say the output voltage can be adjusted by a pot, not by an input voltage. I think you have identified the pin that is controlled by the pot, and connected that to the pwm output of the arduino. Is that correct? Did you remove the pot, or is it still in the circuit?thanks, Keith

    View Instructable »
  • More Activities