# Formatting a SD Card For Steam Deck

It appears that there is a prevalent issue with the Steam Deck corrupting SD cards that can leave them in a unrecoverable condition, this seems to occur mainly on a second formatting rather than the first, so far we’ve not heard anything from Valve about this, but I suspect it’s more likely to be down to the hardware interface rather than a software bug.

Fortunately until we know more you can format your SD card outside of the Deck easily, to do this you will need a Linux live system, assuming you’re not already using Linux, Ubuntu is a good simple choice for this.

Once you have the system running you need to insert your SD card, to identify which device it is use the following command in the terminal:

sudo lsblk

This will show a list of connected storage devices, you can identify the SD card by the size and normally it will be last in the list, in my case /dev/sdg, partitions if there are any will show as /dev/sdg1, /dev/sdg2 and so on.

Once you are sure you have identified the SD card correctly, run the following two commands:

sudo parted --script <device> mklabel gpt mkpart primary 0% 100%
sudo mkfs.ext4 -m 0 -O casefold -F <partition>

The first command creates a new blank GPT partition table, and then a new partition using all the space on the device, <device> should be replaces with your device path, I.E /dev/sdg.

The second command formats the new partition as an EXT4 file system which is what the Deck recommends, <partition> should be replaced with the first partition on your SD card, I.E /dev/sdg1

You can now remove it a insert it into your Steam Deck.

## Hot Swapping

Even though Valve have said you can hot-swap SD cards I don’t recommend it, there is no protection against write corruption so you should only remove it when there is no activity or better unmount it in Dolphin first.

Should you get it to the point where you have problems, run sudo e2fsck -pf <partition> to repair it.

# Installing Emulators on Steam Deck

The Steam Deck is a great device for playing emulated games on, there are a number of options for settings up emulators but I find the easiest to use is EmuDeck.

## Installing EmuDeck

Once you’ve download EmuDeck click on the ‘EmuDeck.desktop’ file and it should ask you if you want to open or execute, if it does not right click on it and select Properties > Permissions and check ‘Is executable’ and press OK.

Once run Konsole will appear and begin installing, it will ask you if you want to install in easy or expert mode, I suggest choosing easy, it will then ask you if you want to install your game roms on internal storage or a SD card, I recommend the latter if you have a SD card.

It will then ask if you want to open the ROM manager, a shortcut will be placed on your desktop as well.

To add games go to /home/deck/Emulation/roms/ or for SD card /run/media/mmcblk0p1/Emulation/roms/, there is a directory for each system, place your ROMs in each one.

Once you are done run the ROM manager, open the preview tab and click ‘Generate app list’, wait until it’s finished then if you’re happy click ‘Save app list’, if you return to Steam game mode you should find your ROMs in the non-steam list ready to play.

If it has incorrectly detected a game wrong you may need to rename the ROM and repeat the process, this should not cause any problems with the game itself.

## MS-DOS Games

The ROM manager doesn’t work for MS-DOS games, to deal with these run EmulationStation, shown as Emu Deck in non-steam games, if you placed your games under dos they should already be detected.

## Keyboard Shortcuts

The shortcuts depend upon what emulator is being used, for a full list look here.

## Lutris

While technically not an emulator sometimes you will want to play Windows games outside of Steam, adding a non-steam game doesn’t always work, to do this the easiest tool to use is Lutris which can also install games for you.

Lutris beta flatpak is now available, to install it do the following in konsole.

flatpak update --appstream
flatpak install --user flathub-beta net.lutris.Lutris//beta

flatpak install --user flathub org.gnome.Platform.Compat.i386 org.freedesktop.Platform.GL32.default org.freedesktop.Platform.GL.default

You can then run Lutris from the KDE Games menu, or add it to Steam, you will need to add a runner first to Lutris, do this in Preferences > Runners > Wine, at this time I’m using lutris-fshack-7.2, once a runner is installed to manually add a game click the add button at the top left, select ‘Add locally installed game’, enter a name and select the Wine runner, under game options set the executable and Wine prefix to a empty directory, the prefix is where the game configuration and virtual filesystem is stored.

You can now right click a game and select ‘Create steam shortcut’ to add it to Steam, all being well it should just work, however this is not always the case, you may need to use Winetricks to install additional components, the Wine Application Database is a good place to start.

## Common Problems

Some of the most common problems are:

# Setting up SSH / SFTP on Steam Deck

Having SSH and SFTP access to your steam deck is very convenient for file transfers and remote administration, setting it up is fairly straightforward.

First you need to have set your password to be able to use sudo, to do this open konsole in desktop mode and type passwd, enter your desired password twice to confirm.

Once that is done you can turn on the SSH server with sudo systemctl start sshd, to login from another system on your network use ssh deck@192.168.x.x, replace with the LAN address of your deck.

## Security

To prevent anyone else logging in, edit /etc/ssh/sshd_config, add the following two lines:

AllowUsers deck@192.168.0.0/16
PermitRootLogin no

Restart the server with sudo systemctl restart sshd, this will only allow a login from your local network, if you want to login from the internet then more stringent security is required which is covered in an article here.

To permanently enable the server use sudo systemctl enable sshd.

## Multiple Bands

There is only a few medium wave stations where I live so I decided to add shortwave as well, to achieve this I used a rotary switch and a 7uH inductor, this is wound on a T50-2 iron oxide toroid, this ensures a high Q factor that would be difficult to achieve with an air core, Unfortunately it’s nearly impossible to tune as it covers near enough the entire shortwave band, so a bit of a failure on my part.

## Antenna Coupling

Originally I used a fixed 10pF coupling capacitor, I have since replaced that with a 35pF variable trimmer capacitor, I find around 25-30pF to be optimal, although it’ll depend upon your antenna and how selective / sensitive you want it.

## Audio Amplifier

To make listening more comfortable and improve reception of weak signals I made an audio amplifier, this can be switched in with a DPDT toggle switch and is powered from four AA batteries, this is capable of driving a 8 ohm loud speaker at a modest volume.

The circuit is nothing special but works quite well, care needs to be taken with the input wiring to avoid hum, shielded or coaxial cable is best.

## Case

This time I decided to make something half decent looking, I glued together some scrap MDF sheet to make a base and front panel, I then applied walnut wood veneer to the front and varnished it, on the front I mounted two 3.5mm jacks, one for crystal earphones and the other the amplifier output, the tuning capacitor, DPDT toggle switch, 1 pole 12 way rotary switch and the volume and gain pots.

On a piece of brass sheet I have a BNC connector for the antenna input, I made a bit of a mess of the veneer during construction but oh well, lesson learned, don’t drill wood veneer.

## Results

Adding an audio amplifier really boosts what can be received, another thing I have considered is adding a LNA (Low Noise Amplifier) as the RF front-end, however at this point it would make more sense to use a different radio technology.

Overall I’m quite pleased with it but there is definitely room for improvement, but for now I’m done with crystal radios, my next attempt will likely be a regenerative or perhaps superheterodyne radio.

A crystal radio is a radio designed for receiving audio (voice) broadcasts, it was invented around the beginning of the 20th century and became extremely popular in the 1920’s and 1930’s, allowing millions of people to access radio broadcasts that otherwise would have been prohibitively expensive, the majority would have been self constructed sets rather than commercial devices, this sparked a huge interest in radio and electronics and ultimately was the catalyst for the rise of commercial radio.

The reduced cost of vacuum tubes and increased reliability led to the downfall of the crystal radio, however it continued to see sporadic usage and has had numerous revivals to the present day, the ease of construction, low cost and no need for a power source means it still sees usage in poor countries and is a popular project for electronics and radio hobbyists.

Crystal radios are primarily designed to receive Amplitude Modulated (AM) broadcasts, although examples have been made that can receive Frequency Modulated (FM) broadcasts, the most common band used is the medium wave broadcast band which roughly spans 530 to 1,700 kHz.

## Theory of Operation

While there are many variations in design all crystal radios consists of four main blocks, the antenna, tuner, detector and speaker.

The antenna is chosen to receive radio waves as efficiently as possible, for medium wave AM band a monopole, loop or ferrite rod antenna is a common choice, there are two options for connecting the antenna to the tuner, magnetic or capacitive coupling, I opted for the latter which is the purpose of C2.

The tuner in the majority of sets consists of a fixed inductor (L1) and a variable tuning capacitor(C1), the tuning capacitor needs a value of at least 500pF to cover the entire medium wave band, for inductance a value between 200uH and 250uH is often used, this forms an LC tank circuit which resonates at a specific frequency, given by the equation:

$$f_0 = \frac {1}{2\pi\sqrt{LC}}$$

Solving for inductance gives the equation:

$$L = \frac {1}{4\pi^2Cf^2}$$

It's preferable to use the lowest inductance possible as longer coils tend to have greater resistance which reduces the Q (quality) factor of the coil, however since Q is tied to bandwidth too much can also be an issue.

In my case for the medium wave band I decided on 220uH inductor and a 720pF tuning capacitor I had in my parts bin, you will most likely want to wind your own inductor as commercial inductors of this value normally use ferrite cores which can introduce losses, it may work fine but I haven’t tested it, in any case using an air core coil is traditional.

The detector (D1 & C3) is used for demodulating (extracting) the audio from the RF carrier, back in the day this was an actual lump of crystal such as galena or iron pyrite, the ‘cat’s whisker’ would be adjusted over the surface until a sensitive spot was found, various alternatives have also been used, for simplicity I went with a 1N34A germanium diode (alternative 1N270), the diode choice is very important, germanium starts to conduct as low as 0.1V, I tried a common silicon 1N4148 which gave very poor sensitivity, a schottky diode may be a viable alternative here, the value of the capacitor is not critical, 1nF worked for me.

Finally for the speaker I used a high impedance piezoelectric earpiece, these have an extremely high impedance, so much so that a 100k resistor (R1) is required to provide a suitable discharge path, traditionally a more conventional high impedance speaker would be used giving an impedance around 3k to 10k, these are still available from places like ebay albeit more expensive.

## Assembly

For designing the inductor I used the excellent free program Coil32 which I highly recommend you check out, this gave me the number of turns required.

Winding the coil is a bit of an art in itself and can only be learned through experience, I typically use a wax coated cardboard tube, wind the coil as neatly as possible, then coat it with more wax to secure it, this has the advantage over varnish that it sets hard right away, in any case the value is not super critical so there is no need to worry if you do not have an LCR meter handy, go with the calculated number of turns and add a few more for luck.

I mounted the coil and tuning capacitor on a piece of scrap wood, since this is so simple I decided against using a PCB and simply wired it point to point, I made provision for swapping the detector parts using female machine pin headers so I could experiment.

I plan on remaking it much nicer at some point, there is many good examples made by Dave Schmarder.

## Testing

Having a strong AM station nearby is pretty much required, you will have trouble receiving weaker stations, although with a good antenna it should be possible, I had no problems receiving a 2kW station located about 3km away even inside the house with a cheap monopole, some European countries no longer broadcast medium wave so you may have more difficulty there.

For a test signal I used my TinySA with 1kHz AM modulation, a signal inserted at -7dBm was clearly audible and was detectable as low as -23dBm, although I noticed a decrease in sensitivity at the low end of the band likely because Q is frequency dependent.

## Improvements

The nice thing about crystal radios is there is a lot of things you can do to improve them, such as adding an audio or RF amplifiers, different bands, different detectors, different coil winding methods, audio transformers and so on, so making one is definitely worth the time.