Thursday, February 21, 2019

Modding my PS1 - Power supply hacking (Part III)

Goal
Once again we'll hack the PS1 here.
This time it will be about the power supply.

DISCLAMER: Working with the power supply means working with 110V/220V. There's no need to modify the high voltage part of the power supply but keep in mind that touching it while it being plugged in or shortly after being unplugged can kill you. Don't do this hack if you're not an electrical engineer. You are on your own. I'm not responsible for anything that can be caused for trying this hack.

My problem is that I don't want to move to power off or reset the console.
The actual button pushing will be electrically done by a Raspberry Pi.
The most known way to turn on and off a switch is using a relay. Those are mechanical stuff that will die slowly, make noise while changing state and be big, among others.
Hopefully solid-state relays were invented and have no moving parts.
https://en.m.wikipedia.org/wiki/Solid-state_relay
I only have electromechanical relays though so I used them.


Inputs and outputs
In order to correctly simulate normal usage, the RPi must know whether the Reset button is pressed and whether the Power button is activated.
This gives 2 inputs.
It must also simulate Reset button (put LOW on one GPIO) and control one relay for 3.5V and another one for 8V.
The two relays will be controlled by the same GPIO.
That makes 2 outputs.

Reading inputs
The Reset button blocks connections between GND and the Reset signal.
In order to read the Reset status we measure the voltage of the left button pins: 0V means Reset is pressed, 3.5V means released.
The Power button controls both the 3.5V and the 8V lines.
This means the Power button being pressed would give 3.5V at the left of the button, and 0V if released.

Controlling power output
As discussed above, we need two relays (3.5V and 8V).
Also we need to cut the traces right after the buttons.


In this photo, I replaced the relays with jumpers


The relays have to connect the power sources and the power connector.
They will be controlled with a GPIO, using the same script than in Part II (software video switch) with another GPIO port.

Controlling reset output
If the RPi is dead I don't want the Reset signal to be sent, which means I'd want the corresponding GPIO not to be put LOW.
For this reason I'll use an NPN transistor.
Once again we'll use the GPIO controlling script.

Making it smart
The last thing to do is making a script reading the Reset and Power states and controlling the outputs based on these.
It is not done yet but it is coming.





Modding my PS1 - Power the Rasberry Pi from the PS1 power supply (PSX-VX Part V)

Goal
In this short article we'll power the RPi with the PS1 power supply.
Powering the RPi with an USB cable is ugly and defeats the purpose of a fully integrated system.

Stepping down from 8V
Unfortunately the supply only provides 3.5V and 8V.
We thus need to lower the voltage from 8V.
For this I use an LM2596 converter.

The principle is fairly simple:
  • PS1 power supply GND goes in IN-
  • PS1 power supply +8V goes in IN+
  • RPi GND goes to OUT-
  • RPi +5V goes to OUT+

LM2596 converter
Left: IN = PS1
Right: OUT = RPi

PS1 power supply: GND and +8V to connector
(Don't mind the 4 red and orange cables at the left)

Adjust OUT+
Before connecting the RPi, you must adjust the output voltage for it to be +5V (±5%).
This is easy: connect the +8V input to the PS1 power supply and put a voltmeter on the output.
Then turn the pot on the converter until the voltmeter shows +5V.

Power the RPi
The Pi can be powered through GPIOs, so OUT+ goes to the +5V GPIO (top right) and OUT- to one of the GND pins.
Everything should work now.

Sources

Modding my PS1 - RGB LED (PSX-VX Part IV)

As my PS1 receives more capabilities than initially thought by Sony, it needs a status LED showing more states than just ON/OFF.
For this reason I need to have more colors than just green.
I chose an RGB LED to replace the original LED.
It will be driven by a Raspberry Pi.


Deleting original LED
Getting rid of it is pretty quick.
Sadly its legs are bent so it's not practical but it will leave without too much work.

Placing the new LED
Hard rework of the traces is out of question so I left the whole LED with its legs above the board.
I bent them at around 100° to be able to solder something on it without touching something on the board.
I put a connector on the legs.
I kept the LED and the connector in place with some hot glue.

Controlling
Solder the VCC (or GND) and the 3 color legs (check if your LED is common anode or common cathode) to the RPi and choosing the color will be as easy as controlling 3 GPIO's.
The intensity of each color will be choosable using PWM.

Code
See the code at: https://github.com/electrojack/psxvx


Don't mind the two blue cables

Video
https://www.youtube.com/watch?v=XR9lDs6q3II

Saturday, February 2, 2019

Using arduino-cli

I missed the arrival of arduino-cli.
This is a great tool as we can finally use arduino libraries and codes without having to use the GUI, which I, personally, can't stand.

As usual my usage is different from the vast majority of people.
In this case I don't burn the bootloader so I can't use the upload functionality of arduino-cli.
Instead I use avrdude.

Everything stays easy though:

1. Follow the instructions here: https://github.com/arduino/arduino-cli


# 2. Install missing core (cf instructions)
nano .cli-config.yml           #add core: https://github.com/MCUdude/MiniCore
arduino-cli core update-index
# 2a. Look for your core
arduino-cli core list
# 2b. install it
arduino-cli core install MiniCore:avr

# 3. search for board name -> MiniCore:avr:328
arduino-cli board listall


# 4. Compile your project
arduino-cli compile --fqbn MiniCore:avr:328 myproject

# 5. Upload .hex file and fuses
sudo avrdude -p m328p -c linuxgpio -e -U flash:w:myproject.MiniCore.avr.328.hex \
       -U lfuse:w:0xe2:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m


I had problems with avr-g++ and other binaries not being found.
I don't have the time to fix this nicely.

I edited ~/.arduino15/packages/MiniCore/hardware/avr/2.0.1/platform.txt


#change this:
#compiler.path={runtime.tools.avr-gcc.path}/bin/
#to this:
compiler.path=/usr/bin/   # or the directory where you have the avr-g++ binary
                          # you can use `whereis avr-g++`