The Retro Center
Home | Blog | Projects | Follow Us
Search Eng Light

Pablo Toledo Guides, Computers 2020-08-13

Super Upgrade Apple iMac Mid 2011 21.5" A1311 – Part 1

Unfortunately, I took very few pictures during the process, so I'll be using some images from the websites where I found information and learned how to make these modifications.

Step 1) Program the ESP32

To carry out this project I based myself on the guide published by the user of Fixing Things, who documented the process of building and programming the microcontroller in charge of controlling the brightness of the screen. His work was very useful to me.

You can consult the original article at the following link:

https://medium.com/@fixingthings/imac-2009-2010-2011-gpu-upgrade-fixing-led-lcd-pwm-brightness-with-an-esp32-bc32da61a0e7

1.1) Install the software, drivers, and dependencies needed to connect to the ESP32

First, follow the guide below to prepare your computer and work with microcontrollers. There you will find instructions for installing the drivers, tools such as Homebrew and Python, as well as their respective dependencies. You can also perform a test of connection with the board:

https://thejoyrobot.com/blog/prepare-equipment-for-working-with-UART-interfaces

1.2) Download the files to be installed on the microcontroller



1.3) Programming the ESP32

1.3.1) Check that the computer recognizes the USB to Serial adapter

Check to see if your computer recognizes any USB-to-Serial devices. On macOS High Sierra and Catalina, use the following command:



Terminal
$ ls -l /dev/cu.*

The system will display all devices that use a USB-to-Serial interface to communicate. Be sure to identify a device named /dev/cu.SLAB_USBtoUART.

If it does not appear, the SiLabs driver may not have been installed correctly or there may be a communication problem between the adapter and the ESP32. Check the cable with another device or test the ESP32 on another computer.



[Screenshot of the detected USB to Serial devices]

If you have multiple devices that use serial communication connected to the computer, I recommend running the command first without the USB to Serial adapter connected and repeating it after connecting. This way you can easily identify which one corresponds to the ESP32.

1.3.2) Perform a connection test with the microcontroller

Press the BOOT button on the board to enable access to the device.

Then run the following command to check the connection to the ESP32:



Terminal
$ esptool.py --port /dev/cu.SLAB_USBtoUART chip_id

If the connection is successful, information corresponding to the microcontroller chip will be displayed.

1.3.3) Change the microcontroller's firmware

Press the BOOT button again and erase the current firmware of the ESP32 by running the following command:



Terminal
$ esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash
Restart the ESP32 by pressing the ON button. Then, run the following command in the terminal to install the new firmware image:

Terminal
$ esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 ~/Downloads/esp32-idf4-20191220-v1.12.bin
Once the installation is complete, restart the ESP32 again by pressing the ON button.

Now, connect to the microcontroller using Picocom:

Terminal
$ picocom /dev/cu.SLAB_USBtoUART -b 115200
Press Enter. If everything is working correctly, the Python REPL interpreter should appear, identified by the >>> indicator.

You can perform some tests directly from the interpreter. To exit Picocom, use the CTRL + A key combination and then CTRL + Q.

Try running an LED test by using the following command:

Terminal
$ ampy --port /dev/cu.SLAB_USBtoUART run test.py

1.3.4) Install the source code on the microcontroller

In the GitHub repository, navigate to the directory micropy and run the following script:



Terminal
$ ./micropy/install_mac.sh
This script will copy all files from the ./micropy/src directory to ESP32.

Once the installation is complete, restart the microcontroller. You should notice that the blue and red LEDs are lit.

If you are using a different variant of the ESP32 or want to use a pin other than D23/GPIO23, you will need to edit the ./micropy/src/pwm.py file and replace the pin=23 value within the __init__ method with the number of the pin you want to use.

After making the change, run the ./micropy/install_mac.sh script again to update the microcontroller files.

Then reconnect using Picocom:

Terminal
$ picocom /dev/cu.SLAB_USBtoUART -b 115200
The ./micropy/src/shell.py script modifies the behavior of the standard input (stdin) of the REPL interpreter, so that it only accepts commands related to brightness control.

If at any point you want to return to the Python interpreter, type:

Terminal
$ repl
To check the brightness control, for example, enter the number 10 (without quotation marks) and press Enter. The LED should reduce its intensity by approximately 10%. Try other values to check that the control responds correctly.

To exit Picocom, use the CTRL + A key combination and then CTRL + Q.

If the LED correctly changes its intensity when entering the different values, it means that the ESP32 is working and you can now continue with the modifications of the iMac.





Previous article
Super Upgrade Apple iMac 2011 - Tools and parts required (Part 0)
I made a hardware upgrade to a 2011 iMac to push its capabilities to the limit. I replaced the processor with an Intel i7-2600S, installed an NVIDIA GTX 765M graphics card, expanded the RAM to 32 GB, and added SSDs and HDDs. I also developed electronic and physical modifications to adapt the cooling system and regain screen brightness control using an ESP32.

Next article
Super Upgrade Apple iMac 2011 - Install Ubuntu to patch VBios (Part 2)
In this part of the project, I prepared the iMac to update the VBIOS of the new graphics card. To do this, I installed Ubuntu on an SSD and configured the computer to boot from it. I also describe how to create a bootable USB drive, access the startup options, and disable SIP before replacing the GPU.

Comments (0)

No comments yet.

Leave a comment

Name
Email
Never shown; we send you a link to confirm it.
Comment
Up to 2000 characters.
Challenge[Challenge image]
Type the characters in the image:
Comments are published once a moderator approves them.

The Retro Center