Posted on 13 Comments

How To Add Brightness Control For The 3.5″ GearBest Screen

This guide might also work on any screen that we use for building our Game Boy Zero as long it uses the CL6201 LED driver IC with the “7001” label on it.

I will be using a Raspberry Pi Zero for this tutorial but any Arduino/Atmel chips with PWM pins can also be programmed to do the job. I have actually tested it with an attiny13a and it works just fine.


Before we start, follow the Wiring Guide for the 3.5″ GearBest Screen with 5V Mod. Then start by soldering a wire from the CL6201’s EN pin 4 to the Pi Zero’s GPIO19 pin. The CL6201 Datasheet says that the EN pin can be used to adjust the brightness by connecting it with a PWM square wave signal between 100Hz and 100KHz. That means with the Raspberry Pi’s capability to produce PWM signal we can control the brightness with it.

For the control buttons let’s use two tactile buttons for increasing and decreasing the brightness. Wire the buttons like this:


You can write a program in Python or C to do the PWM routine but let’s keep it simple by using a progam called pigpio and write a simple python to just call it. Login to your Raspberry Pi and install the program by following the instruction at


We are now ready to test the program. Type the command sudo pigpiod to load the pigpio daemon. Now we can test it with the following command format:

pigs p GPIO DUTYCYCLE(0-255)

GPIO is the gpio pin we want to use which is GPIO19 and DUTYCYCLE is what controls the brightness.


pigs p 19 50

The above code should dim the screen. Try experimenting with other DUTYCYCLE values from 0-255.

Now for the actual buttons to control the brightness I wrote a simple python to call the pigpio program. Copy the code below and paste to a new file with .py extension. You can just name it as if you want.

import RPi.GPIO as GPIO

import subprocess
import time

dutycycle = 255
PWM_PIN = 19

GPIO.setup(BTTN_DIM, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BTTN_BRIGHT, GPIO.IN, pull_up_down=GPIO.PUD_UP)
cmd = "pigs p 19 " + str(dutycycle), shell=True)

def btn_func(a):
   global dutycycle
   global cmd
   if a == 1:
      dutycycle = dutycycle + 25
      dutycycle = dutycycle - 25
   cmd = "pigs p 19 " + str(dutycycle), shell=True)

GPIO.add_event_detect(BTTN_DIM, GPIO.FALLING, callback=lambda x: btn_func(0), bouncetime=300)
GPIO.add_event_detect(BTTN_BRIGHT, GPIO.FALLING, callback=lambda x: btn_func(1), bouncetime=300)

while 1:

Run it by typing the command  python Press each of the buttons and it should increase or decrease the brightness on the screen.

Here’s a demo:

That’s it! Let me know in the comment below if this works for you.

13 thoughts on “How To Add Brightness Control For The 3.5″ GearBest Screen

  1. Hey,

    It’s working with the test “pigs p 19 50”. But where should i save the python file?

    Thanks in advance and keep on the good job.

    1. Found it, i’m a newbie so this is al in the basics….

      1. Care to share the solution for the rest of us newbies?

  2. Is there a way to do this using software controls to brighten or darken the screen after doing this mod? Instead of physical switches?

    1. Yes sure you can do it without any physical switches too.

  3. Tinkerboy,

    Are the tactile switches the same L and R buttons or do I have to add more tactile switches to the gameboy zero? New to this so I feel like I’m missing something here…

    1. You need to add another tactile switch. One switch will do.

  4. How would you do this with a potentiometer (like the volume wheel)?

  5. Do you know if it just need a pulse or a constant square wave? Thinking it might be tidier to have a micro-controller take care of the screen dimming. The one I have can only do short bursts

    1. Yes it’s better with a constant square wave. You can do that with Raspberry Pi hardware PWM or you can use a small avr chip like attiny13.

  6. Cheers for the swift reply. I’m using a picaxe (only because it uses basic and I vaguely remember that from my zx spectrum). I feel like it should work, since it can dim an led with pwm no problem, but I’ve read it cant. I have it all set up here anyway, so I’ll see what it does.

  7. Kinda confused on where to put the python script we wrote?
    works fine using the ‘pigs p 19 50’ command in SSH, but after I made the ‘’ script, I placed it into the boot directory since I couldn’t see any obvious place to put it. And it didnt seem to launch the script.

    So what am I missing? thanks in advance

    1. Put the script in /home/pi. And if you want to run it all the time when Pi starts, edit the file /etc/rc.local and place copy the line before exit.

      python /home/pi/ &

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.