Contribute
Register

Kiwi's Next Project - iMac G5

Status
Not open for further replies.
Well done, Kiwi. Looks very professional! :thumbup:

Hope, it will work fine.

Good luck

MacTester
 
Looks excellent so far! Good luck! …be sure to test it for a while to see if it doesn't die after a few minutes as it has been the case with other people before.
 
Looks excellent so far! Good luck! …be sure to test it for a while to see if it doesn't die after a few minutes as it has been the case with other people before.
What would cause it to die after a few minutes ?
 
What would cause it to die after a few minutes ?
Apparently feeding too much voltage to the inverter or something. Neither me or the people that that happened to know what's the issue exactly, but the inverter seems to get fried. There have been success stories, though.
 
Apparently feeding too much voltage to the inverter or something. Neither me or the people that that happened to know what's the issue exactly, but the inverter seems to get fried. There have been success stories, though.
Sorry you fried your inverter. Using MacTesters guidance I measured everything before my teardown, and also my build uses the original PSU, to ensure compatibility.

Part 11 - SUCCESS... Of my First iMac LCD conversion.

My First Mac LCD conversion went without a hitch, powered on and worked out of the box (so to speak). Playing 720p MKV video produces no artefacts. Did some power measurements at wall socket.

35W - Computer off - Inverter On
45W - VLC Playing 720p MKV file

Just seems crazy that old generation CCFL backlights take way more power than the CPU.

iMac G5 PSU - on the Left hand side is powering
-> the NUC - 12V Yellow Black Cables (towards top photo)
-> the LCD - 12V Yellow Black Cables (centre photo)
-> the Inverter - 24V and 3.3V Green and Red cables (bottom photo)

I have used a short Mini HDMI to HDMI cable connection from NUC to my HDMI socket, that I wired to LCD

Kiwi

IMG_2652.jpg
 
My First Mac LCD conversion went without a hitch, powered on and worked out of the box (so to speak). Playing 720p MKV video produces no artefacts.

Cool! :thumbup:

The HDMI Connector with solder pad is a nice find. I've just ordered one.

BTW:
I was able to get the touch sensors working on the Arduino. Now I try to enhance your code with this functionality. That should allow to adjust the brightness with either the touch sensors or your slider applet...

MacTester
 
Cool! :thumbup:

The HDMI Connector with solder pad is a nice find. I've just ordered one.

BTW:
I was able to get the touch sensors working on the Arduino. Now I try to enhance your code with this functionality. That should allow to adjust the brightness with either the touch sensors or your slider applet...

MacTester
Touch Sensors looked straightforward to implement based on what I read. Would be cool if we could keep some sort of common code base, I have some other enhancements planned. Send me what you finish up with, and Ill try and merge it in.

Kiwi
 
Kiwi,

Here is a first sketch. Works so far. The brightness can now be adjusted with your applet or the touch sensors. To do:
-periodically re-calibration of the touch sensors (such as in the Picaxe)
-Brightness range limits for touch sensors (same as for the app slider)
-report the actual brightness level back to the app, so the slider can be actualized
-adjustable sensor threshold difference via applet preferences ;-)

Code:
#include <SimpleTimer.h>
#include <CapacitiveSensorDue.h>

// A general purpose timer, and some misc constants
SimpleTimer timer = SimpleTimer();

//
// CapitiveSenseDue Library 
// Paul Badger 2008
// Touch Sensor Pin Assignment & Auto-Calibration
//

CapacitiveSensorDue dnSensor = CapacitiveSensorDue(4,2);	// 1M resistor between pins 4 & 2, pin 2 is sensor pin
CapacitiveSensorDue upSensor = CapacitiveSensorDue(4,6);	// 1M resistor between pins 4 & 6, pin 6 is sensor pin

//Touch Sensor Auto-Calibration
long dnSensorInit1 = dnSensor.read(25);
long dnSensorInit2 = dnSensor.read(30);
long dnSensorInit3 = dnSensor.read(35);
long dnSensorThreshold = (dnSensorInit1 + dnSensorInit2 + dnSensorInit3) + 70;

long upSensorInit1 = upSensor.read(25);
long upSensorInit2 = upSensor.read(30);
long upSensorInit3 = upSensor.read(35);
long upSensorThreshold = (upSensorInit1 + upSensorInit2 + upSensorInit3) + 90;

//
// PIN ASSIGNMENTS---------------------------------------------------------------------------
//   

// Inverter Brigtness Pin
const int INVERTER_POUT = 9; // PWM OUTPUT

// PWM Output Pin For Fan
const int FAN_CONTROL_POUT = 10; // PWM OUTPUT Fan Speed Control

//
// GLOBAL VARIABLES---------------------------------------------------------------------------
// 

long dnSensorReading;
long upSensorReading;

//
// SETUP (1x during startup)------------------------------------------------------------------
//

void setup()					
{
  // setup and init EEPROM, on first invocation.
  setupDevice();

  // Setup Brightness Controller
  setupInverter();

  // Setup Serial command processor
  setupCommand();
  
  // Setup the BACKGROUND Timers (only needs to be done once)

  // Timer, which triggers the Touch Sensor Control every 200ms
  timer.setInterval(200,touchControl);

  // Timer, which triggers the SerialMonitor every 1000ms (for sensor calibration only!!)
  //timer.setInterval(1000,serialMonitor);
}

//
// MAIN LOOP----------------------------------------------------------------------------------
//

void loop()					
{
  // serial ports for command processing
  loopCommand();

  // Let the timer run backgound tasks
  timer.run(); 
}

//
// DEVICE---------------------------------------------------------------------------------------
//

  //Setup the device if not initialised
  void setupDevice() {

  // Inverter Brigtness
  pinMode(INVERTER_POUT,OUTPUT);
}

//
// TOUCH SENSOR CONTROL------------------------------------------------------------------------
//

void touchControl() {
  long dnSensorReading1 = dnSensor.read(25);
  long dnSensorReading2 = dnSensor.read(30);
  long dnSensorReading3 = dnSensor.read(35);
  dnSensorReading = (dnSensorReading1 + dnSensorReading2 + dnSensorReading3);

  long upSensorReading1 = upSensor.read(25);
  long upSensorReading2 = upSensor.read(30);      
  long upSensorReading3 = upSensor.read(35);     
  upSensorReading = (upSensorReading1 + upSensorReading2 + upSensorReading3);


  // If the capacitive sensor reads above a certain threshold,
  //  turn on the LED
  if (upSensorReading > upSensorThreshold) {
    Serial.println( increaseBrightness() );
    //digitalWrite(INVERTER_POUT, HIGH);
  }
  if (dnSensorReading > dnSensorThreshold) {
    Serial.println( decreaseBrightness() );
    //digitalWrite(INVERTER_POUT, LOW);
  }
}

//
// SCREEN BRIGHTNESS-------------------------------------------------------------------------
//

int brightness = 0; // current brightness
boolean inverterActive = false;
const int BRIGHTNESS_INC = 10; // todo put this in eeprom

void setupInverter() {
  // get the inital brightness
  brightness = 50;
  
  // activeate the inverter
  activateInverter();
}

void activateInverter() {
  if (!inverterActive) {
    inverterActive = true;
    setInverterPWMBrightness();
  }
}

void deactivateInverter() {
  if (inverterActive) {
    inverterActive = false;
    setInverterPWMBrightness();
  }
}

// Brightness Write (to the Arduino)
void setBrightness(int bright) {
  brightness = bright;
  setInverterPWMBrightness();
}

// Brightness Read (from the Arduino)
int getBrightness() {
  return brightness;
}

int increaseBrightness() {
  setBrightness(brightness+BRIGHTNESS_INC);
  return getBrightness();
}

int decreaseBrightness() {
  setBrightness(brightness-BRIGHTNESS_INC);
  return getBrightness();
}

// Internally called function (actualize the Inverter PWM Out)
void setInverterPWMBrightness() {
  if (inverterActive) {
    analogWrite(INVERTER_POUT,brightness);
  } else {
    analogWrite(INVERTER_POUT,0);
  }
}

//
// USB SERIAL CONTROL--------------------------------------------------------------------------
//

static const char CR = 13;
static const char LF = 10;

// String input from command prompt
// static String command = String(""); 

void setupCommand() {

  //Initialize serial:
  Serial.begin(9600); 
}

void loopCommand() {

  static char serData[32]; // Buffer 
  static int count = 0;

  // if serial port not ready (Leonardo only).
  // dont try to process commands
  if(!Serial) return; 

  while(Serial.available() > 0) {

    // read a byte. and add to the buffer
    char inByte = Serial.read();
    
    // if th read failed
    if (inByte == -1) {
      break;
    
    // if EOL
    } else if ( inByte == CR || inByte == LF ) {
      
      // terminate the buffer
      serData[count++]=0;

      //Convert The array to a String
      String command = String(serData);
      
      // process the command
      processCommand(command);
      
      // clear the command buffer
      count=0;
    
    // protect against overrun of buffer
    } else if (count<30) {  
      serData[count++]=inByte;
    }  
  }
}

/**
 * Brightness increase BI  
 * Brightness decrease BD
 * READ Brightness BR -> (000-255)
 * WRITE Brightness BW(000-255)
 */
void processCommand(String cmd) {
  
    
  String subCmd = cmd.substring(0,2);
  String extraCmd = cmd.substring(2);
  
  if (subCmd.equals("BI")) {
    Serial.println( increaseBrightness() );
    
  } else if (subCmd.equals("BD")) {
    Serial.println( decreaseBrightness() );
    
  } else if (subCmd.equals("BR")) {
    Serial.println( getBrightness() );
    
  } else if (subCmd.equals("BW")) {
    setBrightness( extraCmd.toInt() );
  }
}

//
// REFRESH SERIAL MONITOR CONTENT (For Sensor Calibration only)-------------------------------
//

void serialMonitor() {
  Serial.print("\t");			        // tab character for debug window spacing
  Serial.print(dnSensorReading);		// print dnSensor reading
  Serial.print("\t");
  Serial.print(upSensorReading);		// print upSensor reading
  Serial.print("\t");
  Serial.print(dnSensorThreshold);		// print dnSensor threshold
  Serial.print("\t");
  Serial.println(upSensorThreshold);		// print upSensor threshold
}

// END

The sensors are read 3 times with different parameters. This reduces flickering and gets more stable readings.

Test setup:
iMac%20G4%20Arduino%20Test.jpg


I've used 1MOhm resistors

Good hacking

MacTester
 
Excellent Kiwi!!!

You must be thrilled! Great job with the soldering iron, I'm so glad it paid off for you.


Cheers!
 
Status
Not open for further replies.
Back
Top