Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: Backfeed diode and LM7805 on: August 24, 2011, 05:43:34 pm
The key is not necessarily that the chips Vcc 'stays on longer', but rather that ones has the means to tell that the source voltage is going bye bye to allow the program enough time to save variables to say the EEPROM. Using a battery low type detection circuit, using a external op-amp comparator and generating a interrupt is one method.

 Can't think of a 'simple' or 'for free' method, either software or hardware, to accomplish the task, as one really has to have a handle on quite a few details, including how long the 'save' operations requires worst case, and what detection method one will be using, how long the main loop function cycle time is, etc.

I have a sketch around here somewhere where the Arduino can measure the actual specific Vcc voltage value at it's power input pin, but it would have to be called at a frequency often enough to be useful in the main loop, depending on the Vcc decay time for a specific project.


The way I am doing it (although untested so far) is to incorporate a voltage divider that I have before the voltage regulator.  This is basically for measuring the mains voltage for something else unrelated (I am not putting mains straight through it, it is protected but that is irrelevant for this topic).  So I have a way to detect that the mains voltage is present or not.  In the event that mains is lost, the arduino saves the required values to the eeprom and then switches doff everything (the supercap runs through a transistor).  I may ditch the transistor and just save the values and then stop everything until either the power is reinstated or there is not enough power for the chip. 

After a quick test, the supercap kept a LED illumintated for just over 2 hours and watching the multimter, the drain is quite slow.  I need to test it some more, but I am 90% confident that it will power an arduino (when fully charged) for at least 10 seconds, which should be more than enough time.
2  Using Arduino / General Electronics / Re: Backfeed diode and LM7805 on: August 24, 2011, 01:24:50 pm
Thanks for the help.  i had not actually thought about the supercap being discharged doing this.  I guess the minimum I really need is for the arduino to remain powered long enough to save some values.  It would be nice if it could stay on longer, but it is not essential.

Thanks again.
3  Using Arduino / General Electronics / Backfeed diode and LM7805 on: August 24, 2011, 05:37:30 am
Just a quick question really. I just want to make sure I have done this right.  Here is a schematic of the lm7805 part of my circuit. 

Uploaded with

It gets fed 12V DC and the output goes to the 5V rail.  My issue is that there is a supercap also connected to the 5V rail, so in the event of a power cut or something, the input will be a 0v and the output still at 5V (or there abouts).  I have added a diode across the LM7805 to prevent backfeed, but Im not sure if it is the right way to do it.  I think it is, but thought i should check before trying it.

4  Using Arduino / General Electronics / Re: Will this Hall Effect sensor work? on: June 01, 2011, 03:56:58 pm
Thanks for that.  That is the answer I was hoping for.  I already bought it, so it doesn´t matter they are out of stock, but thanks for noticing.
5  Using Arduino / General Electronics / Re: Will this Hall Effect sensor work? on: June 01, 2011, 03:06:09 pm
No I am not, I am in Spain, I do have already a very similar device, but that is not what I am trying to achieve.  This project isn´t for monitoring,  It is more of a control circuit.  I need to know how much power is being consumed in order to carry out other tasks. 
6  Using Arduino / General Electronics / Will this Hall Effect sensor work? on: June 01, 2011, 02:38:06 pm
I am building a circuit to calculate power consumption of appliances.  After reading a lot on here, as well as other sites, I decided that I liked the idea of these Hall effect sensors.  The thing is, I just notice that it says the frequency bandwidth is 100KHz, does that mean they are not going to work at mains voltage frequency (50Hz) or that they are a bit overkill and will work up to 100KHz?

The circuit will be measuring 0 - 20A max, and I like these because there is a little headroom just in case.

7  Using Arduino / General Electronics / Re: Have I bought the wrong multiplexer? on: May 28, 2011, 11:01:08 am
Thank-you, danke, gracias, merci, grazie. That worked. All I got to do now is getting working with the arduino, which shouldn´t be too hard. 

Do I need pulldown resistors on a, b, c as well as the switches or do I just need them on the switches?

Many thanks again
8  Using Arduino / General Electronics / Re: Have I bought the wrong multiplexer? on: May 28, 2011, 06:14:05 am
It lights the LED inverted, so I think it should be alright, I don´t have suitable transistor to try it anway.  I´ve tested it with a mutimeter and i get 0,27v on W irrespective of whether the inputs or a b or c are connected.  I´ve tried 2 other multiplexers (I bought a pack of 5) and get the same results with all of them.  Completely stumped now. 
9  Using Arduino / General Electronics / Re: Have I bought the wrong multiplexer? on: May 28, 2011, 03:01:23 am
It still doesn´t work and I dont know why.  I have stripped it down to make it a simple as possible with as few components as possible, and still nothing.

My theory behind this is that a,b and c are all high, so D7 is selected, which again is high, so the LED on W should be on, but its not.  If I switch to W and Y it is on, but disconnecting D07 and it remains on.  It doesn´t seem to be reading the inputs.

My original circuit had D0 - D5 to switches and a,b,c, w to the arduino.

Should this work and have I just been sent a dodgy chip?
10  Using Arduino / General Electronics / Re: Have I bought the wrong multiplexer? on: May 27, 2011, 05:36:17 pm
Thanks both of you, I understand it now.  I have it wired up right then and at least I´ve not ordered the wrong ones. 

The 74HC595 is shift register, no?  I have one of these to play with next, when the multiplexer is work.
11  Using Arduino / General Electronics / Have I bought the wrong multiplexer? on: May 27, 2011, 05:01:27 pm
I have bought 5 of these

I am trying to multiplex switches, so i can have more switches with less inputs.  I hooked it all up to the arudino and it didn´t work.  Checked the datasheet again and it says supply voltage 5v, but says high-level input voltage 2v and low-level input voltage 0.8v.  Am I only supposed to supply 0.8 - 2v to the switches?  At the minute I have the 3 data select pins (A, B, C) directly to arduino pins 3, 4, 5 and the output (W) to arduino 6.  The switches are hooked up with one side to 5v then the other side to one of the inputs on the SN74LS251 (D0-7)with a pulldown resistor to ground.  I have a feeling these switches shouldn´t be going to 5v but more like 0.8 -2v, but I don´t really understand the datasheet.  Could someone help me please?
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: Switch Case Menu Problem on: January 21, 2011, 03:59:04 am
After a bit more searching with the serial monitor I have discovered that I was geting a double press of any button.  However, I have just tried it again to get a print out for this post and I am no longer getting the double push thing, but the menu is still not working.  

Here is how I am doing the switches,
void SWstates () { //Sets the switch States
      SW1CurrentState = digitalRead(SW1);  //Get Current State of SW1
      SW2CurrentState = digitalRead(SW2);  //Get Current State of SW2
      SW3CurrentState = digitalRead(SW3);  //Get Current State of SW3
      SW4CurrentState = digitalRead(SW4);  //Get Current State of SW4
      //Sets SW1 State and debounces
      if (SW1CurrentState != SW1PrevState) {  
            SW1DebounceTime = millis();  // reset the debouncing timer
      if ((millis() - SW1DebounceTime) > debounceDelay) {
        SW1State = SW1CurrentState;
        if (SW1PrevState == HIGH && SW1CurrentState == HIGH && (millis() - SW1DebounceTime) > 3000) {
        SW1StateHeld = 1;
      else {
      SW1StateHeld = 0;
      SW1PrevState = SW1CurrentState;

        //repeats if statements for the other buttons
The debounce delay is 50ms.
I think I need to look at a different way to do this bit, which I will do when I get home.
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: Switch Case Menu Problem on: January 20, 2011, 06:14:51 pm
Ok I tried with the serial.print (very good idea BTW) and found that selecting the back option change the logsmenu value to 1 not 0 like it should do.  The thing is I´ve no idea why, the way I see the code it should be 0.
14  Forum 2005-2010 (read only) / Syntax & Programs / Switch Case Menu Problem on: January 20, 2011, 01:06:21 pm
I´m building a menu system for a timer I am working on.  Its my first proper project and I am trying to do as much of it as I can on my own, but i´m stumped by one particular problem.

What I am trying to is have a main menu with several sub-menus where you change options, etc.  So far I have got to the first option ("logs") and while the main menu and sub menu work, the last option in the sub menu ("back") doesn´t work.  What it should do when you press SW2 (a push button) is go back to the main menu, but instead it reverts back to the first option in "logs" menu.

Here is the relevant code,
void mainmenu(){
      switch (menuLV1){
            case 0: //LOGS
                  LCDmsgNo = 5;  
                  LCD2msgNo = 1;
                  if (SW1State == LOW && SW2State == HIGH && SW2PrevState == LOW){
                  logsMenu = 1;
            case 1: //Settings
                  LCDmsgNo = 6;
                  LCD2msgNo = 1;
            case 2: //Information
                  LCDmsgNo = 14;
                  LCD2msgNo = 1;
            case 3: //Advanced Settings
                  LCDmsgNo = 7;
                  LCD2msgNo = 1;
      // Cycle through Menu Options
      if (SW1State == HIGH && SW2State == LOW && SW1PrevState == LOW){
      // Loop back to begining of menu
      if (securityLvL == 0 && menuLV1 > 2){ //normal user
        menuLV1 = 0;
      if (securityLvL == 1 && menuLV1 > 3){ //Engineer
        menuLV1 = 0;
      ////////// LOGS MENU /////////////
      if (logsMenu > 0){ // Only Run if logsMenu is Activated
            if (logsMenu > 4){  //returns menu cycle back to beginning
            logsMenu = 1;
            switch (logsMenu){
                  case 1: // Total Credit
                        LCDmsgNo = 9;
                        LCD2msgNo = 4;
                        if (SW1State == HIGH && SW1PrevState == LOW) {
                        logsMenu ++;
                  case 2:  // Credit in Coin Box
                        LCDmsgNo = 10;
                        LCD2msgNo = 5;
                        if (SW1State == HIGH && SW1PrevState == LOW) {
                        logsMenu ++;
                  case 3: //Total Power Consumption
                        LCDmsgNo = 11;
                        LCD2msgNo = 6;
                        if (SW1State == HIGH && SW1PrevState == LOW) {
                        logsMenu ++;
                  case 4: //Back
                        LCDmsgNo = 12;
                        LCD2msgNo = 1;
                        if (SW1State == HIGH && SW1PrevState == LOW) {
                        logsMenu = 1;
                        if (SW2State == HIGH && SW2PrevState == LOW) {
                        menuLV1 = 1;
                        logsMenu = 0;

I can post the rest of the code if required, but I think the problem lies somewhere here.  Either I have misunderstood the use of Switch Case or I´m doing something dumb.

Thanks for any help you can give.
15  Forum 2005-2010 (read only) / Interfacing / Re: emulate air conditioner's thermistor to control it on: December 14, 2010, 04:19:58 am
Ignore what I said earlier, if you are switching the mode over it wont work.

The only real reference to the thermistors in the service manual are the vales I posted above and this for a C7 and C9 error,

When the thermistor input is more than 4.96 V or less than 0.04 V during compressor
[ch8727] (reference)
When above about 212°C (less than 120 ohms) or below about –50°C (more than 1,860

I dont know if that is any use to you.  The wiring diagram in the service manual is the same as you already have, the only difference being that it has more labels.  So that wont be any use to you.

Pages: [1] 2