WiP Raspberry Pico Microdrive Hardware Emulator

Show us what you're working on, (preferably with screenshots).
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

Decided to take the plunge and learn how to program a Raspberry Pico Micro Controller and, after messing around a lot with Oqtadrive, decided to create a hardware emulator for the Microdrive as my first project because two obviously isn't enough :-)

I wanted to mirror the Pi1541 project whereas the solution is standalone with a mini screen, SD Card to house all the files and it is all controlled by a few buttons, and that is exactly what I've made.

Introducing the ZX PicoMD (I may come up with a better name!)

Image

All you need is a Raspberry Pico (or Pico W) which luckily are easy to get hold of and very cheap at around £4.

The prototype is a bit messy but works great. It can LOAD, SAVE, ERASE, FORMAT and use a menu system to insert new cartridges into one of the 8 drives. You basically load up the SD Card with all your favourite games (all converted with Z80onMDR of course) and off you go.

The menu system can also power off (not really needed as I always close the files once the drive has stopped so nothing should be in cache), eject the SD Card (so you can load more games), format the cartridges, show cartridge info (simple CAT to the OLED) & save your work to SD card. It works with fat32 and exFat formatted cards as well.

Image Image

In terms of coding I've taken advantage of the two cores on the Pico, one for handling the Menu, OLED & SD Card access and the other to run the emulation which needs critical timing i.e. no interrupts.

I'm in the process of creating a PCB to house it all, similar to the ones I've created for Oqtadrive. Circuit is relatively simple, but it does need a logic level converter for the data lines (need input & output) & 9v reducing to 5v to power the Pico. Rest is handled by diodes & pull ups (write protect can be added or simply connect it to the 9v line so it is always unprotected)

Image

Still a few bits to-do before full release, mainly the PCB with 3D case and porting Z80onMDR. I'm also looking at adding wifi access via the Pico W, focusing on file transfer, but might not bother as the SD card is easy enough.

Open to other suggestions if you have any and once the PCBs arrive I'll advertise for some beta testers if anybody is interested in giving it a go.

Finally big shout out to Alex for his help in troubleshooting and open sourcing Oqtadrive which was a massive help.

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
Czarnikjak
Dizzy
Posts: 67
Joined: Wed Feb 02, 2022 10:53 am

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by Czarnikjak »

Looks interesting, I assume it requires Interface 1?
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

Czarnikjak wrote: Tue Oct 04, 2022 10:26 pm Looks interesting, I assume it requires Interface 1?
Yes it does. Emulating an IF1 would definitely make an interesting project after this one...
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
xelalex
Dizzy
Posts: 52
Joined: Sat Mar 17, 2018 6:13 pm

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by xelalex »

@TomD Great to see OqtaDrive has a little brother now :-) Looking forward to testing it!
User avatar
PeterJ
Site Admin
Posts: 6879
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by PeterJ »

Excellent work @TomD. Are you programming the Pico in C? It's great you able to use the Pico as it's cheap, and easily available (unlike other Raspberry Pi models).

If you can include WiFi, I personally feel that would be a huge plus.

Do you hope to offer a construction service?
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

PeterJ wrote: Wed Oct 05, 2022 7:31 am Excellent work @TomD. Are you programming the Pico in C? It's great you able to use the Pico as it's cheap, and easily available (unlike other Raspberry Pi models).

If you can include WiFi, I personally feel that would be a huge plus.

Do you hope to offer a construction service?
Yes using the C SDK to program instead of Micro Python, mainly as I don't know how to program in Python but also not sure it would be fast enough due to the interpreter overhead and the Microdrive needing 6us precision (may be fine as not tested). I didn't go as far as using the PIO, although that does look very interesting. Luckily for me somebody has already ported FatFS which made the SD Card part a lot easier.

Once I get the PCBs I will definitely offer them out and can make some up if required. All you'll need to do then is pop the Pico in or I could even supply fully built if there is demand. I bought enough stuff to make up 5 as cheaper to buy the bits in bulk.

WiFi on the list.

Cheers

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

For those interested here are the menu navigation options:

Image

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

PCB Ordered

Image
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
dfzx
Manic Miner
Posts: 683
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by dfzx »

Are you planning to release the source of your microdrive emulator? Pico code and gerbers?
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

dfzx wrote: Tue Oct 11, 2022 4:05 pm Are you planning to release the source of your microdrive emulator? Pico code and gerbers?
Initially I will release the UF2s and pop the PCB on PCBWay shared projects so people can make their own. Eventually I'll open source once I've tidied up my code :-)

There are also a few things I want to add/change such as the current PCB doesn't allow downstream comms to other Microdrives yet and I'd like to fix that before putting it out there.

If you are in the UK and fancy have a mess around with one (beta test it for me) I can send you a prototype PCB once they arrive?
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
dfzx
Manic Miner
Posts: 683
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by dfzx »

OK, good to know. :)

I have a couple of Pico based Spectrum projects at the PCB stage (boards currently on their way from China) and when they are done I was thinking about a hardware IF1 emulator based on a Pico. That should be relatively straightforward compared to what you've done. Clearly, pairing such a thing up to your microdrive emulation would be highly desirable so you might be planning that yourself.

Unfortunately I don't have an IF1 (which is at least part of the reason I want an emulated one), but when I start work on an emulated one I'll be after one of your "Pico microdrives". I can get one made if you've opened the source and design, which is why I asked. If you happen to have spares so much the better! But not just yet...
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

PCBs have arrived and all working well, so far anyway.

Image
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
dfzx
Manic Miner
Posts: 683
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by dfzx »

Just a week for the PCB fab? Where did you get that done?
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

dfzx wrote: Thu Oct 13, 2022 10:19 pm Just a week for the PCB fab? Where did you get that done?
JLPCB, they are very fast although postage isn't cheap
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
dfzx
Manic Miner
Posts: 683
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by dfzx »

TomD wrote: Thu Oct 13, 2022 11:19 pm JLPCB, they are very fast although postage isn't cheap
Oh right, they're the ones I use but I always use the postal service because I'm too cheap to pay the courier fees. :lol:
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

I've created a gitHub repository so if you are interested in building your own all the files will be on there (eventually)

https://github.com/TomDDG/ZXPicoMD

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

Works well with the Multiface :-)

Image
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

I've put the PCB on PCBWay if you would like to purchase. Also entered it into the compo if you fancy voting for it :-)

https://www.pcbway.com/project/sharepro ... 50e81.html
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

and a, terrible, video of it in action https://www.youtube.com/shorts/1t1uLbgz_Y4
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

New version released adding a rudimentary filename selector when saving cartridges to the SD card. Grab it at the usual place https://github.com/TomDDG/ZXPicoMD

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
PeterJ
Site Admin
Posts: 6879
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by PeterJ »

Thanks @TomD,

It's a great device.

Please could you go through the process of updating the firmware. Via Windows or Ubuntu is fine. I'm familiar with the Raspberry Pi, but not the Pico.

I've downloaded the document you mention in your GitHub page, but I'm not sure where to start.

Thanks
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

PeterJ wrote: Fri Nov 25, 2022 5:25 pm Thanks @TomD,

It's a great device.

Please could you go through the process of updating the firmware. Via Windows or Ubuntu is fine. I'm familiar with the Raspberry Pi, but not the Pico.

I've downloaded the document you mention in your GitHub page, but I'm not sure where to start.

Thanks
Sure. The Pico is extremely easy to flash. Open the case using the two screws on the botton, then on top of the Pico board you will see a small white button. This is the boot selector. When connecting the Pico to a PC using a USB cable, press and hold the button down (before connecting). Once connected let go and a folder should appear on your desktop, similar to when you plug in a Flash drive. All you need to do now is drag & drop the UF2 file into the folder and the Pico will auto disconnect and reboot with the new code running.

As you've got a made up system you can also use the reset button on the case (far right). Connect the USB cable, hold down the boot select button on the Pico and press the reset button. Now let go of the boot select button and the folder should appear.

Hope that helps.

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
User avatar
PeterJ
Site Admin
Posts: 6879
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by PeterJ »

Thanks @TomD,

Much appreciated.
User avatar
TomD
Manic Miner
Posts: 379
Joined: Tue Nov 13, 2018 9:47 am
Location: Leeds UK
Contact:

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by TomD »

New version released with support for adding real h/w Microdrives downstream of the ZXPicoMD, useful if you want to copy files off ailing cartridges. Having the ZXPicoMD device as 1st in the chain allows it to control the COMMs shift register which in turn allows the mix of virtual drives and real h/w drives with any drive combination. For example, you can have real drives set to 1 & 4 and the rest virtual. CAT 1 accesses the 1st real h/w drive, 4 the 2nd real h/w drive and all others access the emulated drives.

New menu options added to easily switch between real h/w & virtual:
Image

I've only released this version as beta as I'm only able to partially test with real hardware. Unfortunately, I've only got 1 real MD connector block :-) I did try it with a vDrive as the 2nd device and it was fine. Hopefully when others have tested with real h/w any bugs can be ironed out.

New version can be downloaded from GitHub along with instructions on how to use (https://github.com/TomDDG/ZXPicoMD)

TomD
Retro enthusiast and author of Flynn's Adventure in Bombland, The Order of Mazes & Maze Death Rally-X. Check them out at http://tomdalby.com
zx-heinz
Drutt
Posts: 28
Joined: Fri Dec 02, 2022 6:16 pm

Re: WiP Raspberry Pico Microdrive Hardware Emulator

Post by zx-heinz »

Hello Tom, your device looks very interesting! Is it possible to tranfer .tap-files to the SD-Card or do you at least intend to extend your drive to this option?
Post Reply