[f] AMB on Facebook

Power controller

Discussion of future application modules and devices.

Moderator: linux-works

Power controller

Postby dsolodov » July 6th, 2014, 12:07 pm

Got hardware and software working :D for a power controller based upon ATtiny85. The controller features:
  • hardware debounce for the push button;
  • support for alternating polarity dual color LEDs;
  • an optocoupler based interface to an external 5-30VDC trigger to integrate to a receiver based or similar trigger;
  • low side power switch to turn on/off an external device such as a relay.
    The MOSFET switch supports up to 15A and was tested with 2A load.;
  • an analog port to interface with an analog temperature sensor or other sensor;
  • timer based turn-off;
    The thinking is to turn off the audio device after ~3 hours to preserve the caps in case the owner has left and forgot to turn off.
  • interrupt driven code with ATTiny in power down mode most of the time.
    The board's power consumptions measures 0.35mA with LED off and 6mA with LED on
  • the PCB is 60x45mm;
  • a separate switching PSU with matching board size for stacking and ~68% PSU efficiency.

The code compiles to ~1600 bytes, so plenty of space for extra code is available in both Attiny45/85 and ATmega328.

Schematic v.0.02ss.jpg

Pctrl v0.06.JPG

Edit 8/21/14: Removed pictures of the prototype and added 3D preview.
Edit 1/13/15: Updated boards' dimentions.
You do not have the required permissions to view the files attached to this post.
Last edited by dsolodov on March 9th, 2016, 8:54 pm, edited 5 times in total.
Completed AMB projects: M³, σ11, σ25, ε24, γ1, γ2, LCDuino
User avatar
dsolodov
 
Posts: 362
Likes: 30 posts
Liked in: 4 posts
Joined: September 4th, 2010, 10:02 am
Location: Canton, MA
Country: United States (us)

Re: Power controller

Postby cobretti » July 6th, 2014, 3:06 pm

Well, I would probably never find a use for it, at least for now. But, if you have a free pin on the micro available, would it be possible to wire a few DIP switches through resistor network to select different times? Just a thought. 8-)
User avatar
cobretti
 
Posts: 602
Likes: 18 posts
Liked in: 23 posts
Joined: July 9th, 2011, 5:41 am
Location: Weymouth, Taxachusetts
Country: United States (us)

Power controller

Postby dsolodov » January 13th, 2015, 7:06 pm

A DIP switch is a nice idea for higher volume. A DIP switch could be read directly as high-low and use I/O pins on the MCU. A DIP switch would need at least 2 pins, so ATtinyX4 would be required. The current board uses all pins except the pin 1 on ATtinyX5.

ATtinyX5 pins assignments on the controler are:
8 - VCC
7 - Analog temperature sensor
6 - Optocoupler for 12V input trigger
5 - Momentary button
4 - Gnd
3 - Control of MOSFET based switch for the external circuit up to 15A
2 - Control indicator LEDs (High/On and Low/Off states)
1 - Reset

Two options:
A. Update the constant in the code and update the MCU with the updated firmware.
B. The code uses MCU pin 7 through JP3 to read the voltage from the the precision LMT87 (http://www.mouser.com/ds/2/405/lmt87-373050.pdf) temperature sensor. The code switches to the off state, if the sensor reports the voltage corresponding to temperature above 55C, which is defined through a constant. The 55C temperature threshold corresponds to 1888mV or lower on the JP3 as per the datasheet for LMT87. So at long as the supplied voltage is below the threshold, the controller will switch to the off (low) state.

On the physical side, the SMD version of LMT87 is small. I unintentionally flooded the pins and then used he solder wick to remove extra solder on the sensor mounting boards. Through hole TO-92 version of the sensor is available as well.

The PSU for the board is switching RAC01-05SC for 68% efficiency. The board has its own fuse as Amb recommends (http://www.amb.org/forum/transformer-goof-t1786.html?hilit=fuse#p16532) . The holder is for Littelfuse TR5/TE5 fuses. These are neat. The fuse values go down to 0.05A! (http://www.littelfuse.com/products/fuses/axial-radial-thru-hole-fuses/tr5-fuses.aspx)

I calibrated my ATTiny85 chips using Fluke 287 and the available code (http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/). The controller's code reads PSU voltage before taking a measurement from the sensor. Prior to calibration the temperature reading was >2.5C off. After calibration the reading is within 0.1C against the reading by Fluke 62. :)
You do not have the required permissions to view the files attached to this post.
Last edited by dsolodov on January 17th, 2015, 8:14 am, edited 1 time in total.
Completed AMB projects: M³, σ11, σ25, ε24, γ1, γ2, LCDuino

cobretti likes this post.
User avatar
dsolodov
 
Posts: 362
Likes: 30 posts
Liked in: 4 posts
Joined: September 4th, 2010, 10:02 am
Location: Canton, MA
Country: United States (us)

Re: Power controller

Postby cobretti » January 14th, 2015, 1:36 pm

Looks good.
User avatar
cobretti
 
Posts: 602
Likes: 18 posts
Liked in: 23 posts
Joined: July 9th, 2011, 5:41 am
Location: Weymouth, Taxachusetts
Country: United States (us)

Re: Power controller

Postby cobretti » January 17th, 2015, 6:36 am

I would like to know more about LMT87 temp. protection. Does it have any Hysteresis? Does it auto reset or is it manual resettable from OFF back to ON state? Can I see the code please? I am guessing you programmed MCU in Arduino...?
User avatar
cobretti
 
Posts: 602
Likes: 18 posts
Liked in: 23 posts
Joined: July 9th, 2011, 5:41 am
Location: Weymouth, Taxachusetts
Country: United States (us)

Re: Power controller

Postby dsolodov » January 17th, 2015, 2:08 pm

The code is written with focus on a state machine for control of power to a relay for mains power. Pressing the push button or external 12V trigger going 'high' is an event that will turn on the relay. Pressing the push button, external 12V trigger going 'low', reading of a temperature above a threshold, and timeout are events that will turn off the relay.

Power Controller Diagrams.jpg


cobretti wrote:I would like to know more about LMT87 temp. protection. Does it have any Hysteresis?

The overall state machine at a high level is described above. If temperature is above a threshold value, the logic will turn off the device. The assumption, which is not always valid, is the initial temperature is below threshold. Ups.

cobretti wrote:Does it auto reset or is it manual resettable from OFF back to ON state?

Currently once the state is OFF (low) only pressing the button or optical trigger going high will result in ON( high) state. You got me thinking. Maybe after auto shutdown for any reason, only the button (i.e. user action) should be capable to trigger ON.

The code uses the temperature threshold to turn off only. The thinking was to have the feature as a protection from overheating assuming turning off the relay will result in lower temperatures.

cobretti wrote:Can I see the code please? I am guessing you programmed MCU in Arduino...?

Arduino IDE is used.

Code: Select all
...
#define MAX_TEMPERATURE_THRESHOLD 55

#define TEMPERATURE_READING_INTERVAL ..

...
AppData appData;
...
// Calibrated for the specific MCU
const float Vbandgap = 1.1 * 1000 * 5150.0 / 5209.0;
...
     uint8_t nextState = LOW
               ,triggerUpdate = 0;
     AppData::LastAction la = AppData::UNKNOWN_ACTION;
...
     AppData::LastAction storedLastAction = appData.getLastAction();
     if((storedLastAction == AppData::BUTTON_TURN_ON || storedLastAction == AppData::OPTO_TURN_ON)){
        float tempC = 0.0;
        if( appData.getTemperatureSensorPresenceFlag() == HIGH
            && appData.isTimeoutReached4TemperatureReading( TEMPERATURE_READING_INTERVAL)){
           VccReader vccReader(Vbandgap);
           long mVolts = vccReader.readVccMillivolts();
           LMT87 lmt87( sensorPort, mVolts); 
           tempC = lmt87.readTemperatureC();
           appData.setTemperatureReadTimestamp( appData.getWDTCounter());
           }
        if( tempC >= MAX_TEMPERATURE_THRESHOLD){
           // Turn off the device
            nextState = LOW;
            triggerUpdate = 1;
            la = AppData::TEMPERATURE_TURN_OFF;
            }     
        else if( appData.isTimeoutReached( MAX_INACTIVITY_DURATION)){
           // Turn off the device
           nextState = LOW;
           triggerUpdate=1;
           la = AppData::WDT_TURN_OFF;
           }
        }   
...
  if( triggerUpdate == 1){ 
     appData.setPowerStatus( nextState);
     appData.setLEDStatus( nextState);
     appData.setLastAction( la);
     digitalWrite( powerPort, nextState);
#ifdef USE_LED 
     digitalWrite( ledPort, nextState);
#endif
     }
You do not have the required permissions to view the files attached to this post.
Completed AMB projects: M³, σ11, σ25, ε24, γ1, γ2, LCDuino
User avatar
dsolodov
 
Posts: 362
Likes: 30 posts
Liked in: 4 posts
Joined: September 4th, 2010, 10:02 am
Location: Canton, MA
Country: United States (us)

Re: Power controller

Postby Shaman » January 18th, 2015, 2:14 am

Nice! 8-)

Are there any I/O pins left to add an IR trigger?
Shaman
 
Posts: 158
Likes: 0 post
Liked in: 1 post
Joined: April 20th, 2010, 4:21 am
Country: Greece (gr)

Re: Power controller

Postby cobretti » January 18th, 2015, 12:58 pm

Could be added on pin6 after the opto-coupler through the diode or something like that my guess..... 8-)
User avatar
cobretti
 
Posts: 602
Likes: 18 posts
Liked in: 23 posts
Joined: July 9th, 2011, 5:41 am
Location: Weymouth, Taxachusetts
Country: United States (us)

Re: Power controller

Postby dsolodov » January 23rd, 2015, 4:51 pm

In the 'as is' configuration, there are not easily available free pins that can be used without quite a bit of effort.

IR may be used instead of the temperature sensor on the analog input header JP3 as it goes directly to the MCU. Software to handle an IR sensor is required as well.

LCDDuino supports IR control including learning and can be operated without the LCD, if I recall correctly.
Completed AMB projects: M³, σ11, σ25, ε24, γ1, γ2, LCDuino
User avatar
dsolodov
 
Posts: 362
Likes: 30 posts
Liked in: 4 posts
Joined: September 4th, 2010, 10:02 am
Location: Canton, MA
Country: United States (us)

Re: Power controller

Postby theenggprojects » February 11th, 2018, 11:42 am

Hi,

If you are working on Arduino then you should have a look at Introduction to Atmega328. I have written this article and have tried my best to share all the details. I hope you guys will enojy it.

Thanks.
theenggprojects
 
Posts: 3
Likes: 0 post
Liked in: 0 post
Joined: February 11th, 2018, 7:31 am
Location: Lahore
Country: Pakistan (pk)

Next

Return to Other devices

Who is online

Users browsing this forum: No registered users and 3 guests

Quick Links

AMB audio DIY resources
AMB audio shop