Arduino experts

Other FPGA systems, e.g. Turbo Chameleon.

Moderators: Mug UK, Zorro 2, spiny, Greenious, Moderator Team

Post Reply
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Arduino experts

Post by PeterS »

Hi,

I briefly dabbled with an arduino about 5 years ago and I am trying to build the project below but now having much luck.

https://github.com/ChrisDeadman/Usb2Ps2 ... c/main.cpp

I moved most of the libs to the folder /home/peters/snap/arduino/current/Arduino/libraries and squashed their folder structure but the PS2 lib doesn't build

Usb2Ps2Mouse:6:1: error: 'PS2PortSAMD21' does not name a type; did you mean 'PS2Port'?
PS2PortSAMD21 ps2Port;
^~~~~~~~~~~~~
PS2Port



I also moved it's files to the same as the project but that didn't work either.
tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

This project is configured/structured to be compiled in PlatformIO IDE, not in Arduino IDE.

If you really want to compile it in Arduino IDE, you have to rename the main.cpp to Usb2Ps2.ino and place it inside Usb2Ps2 folder. Then you have to extract lib folder content to you Arduino library folder. You should keep the main folders (HIDMouseController, PS2Device, Utils), but move each src and include folders content to the main folder of the respective library. Finally, you have to install support (toolchain) for the SAMD (Cortex M0+) boards.
Clipboard-1.png
You do not have the required permissions to view the files attached to this post.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

Thanks, I wasn't going to spot that.

I have all ready done most of what you describe but I am not clear which samd21 lib to install.

It looks like Platformio needs another ide (VSCode).
tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

Yes, PlatformIO is a VSCode plugin. Yet compiling anything bigger in Arduino IDE is a nightmare. It is good for single file 8-bit AVR projects.

You should choose the board you have, the project wiki mentions ATSAMD21G18 (SparkFun SAMD21 Mini Breakout). I have chosen a built-in Arduino SAMD board (Arduino M0 Pro), and it compiled fine.
User avatar
christos
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2506
Joined: Tue Apr 13, 2004 8:24 pm
Location: Greece

Re: Arduino experts

Post by christos »

The Arduino ide is a nightmare.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

I am using Lubuntu 18.04 so I installed VS Code but the Platformio plug complained about python3-distutils being missing.

I tried to install it but keep getting a 404 error.

So I tried to upgrade Lubuntu but it looks like it cannot be upgraded past 18.04 since they changed the desktop !!

Not exactly convenient. I am really glad the Atari world doesn't do stuff like this.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

I found the missing Deb packages for Python 3.7 and installed them and VS Code was able to install the PlatformIO plugin.

Hopefully I can get this Arduino app built now but it might need a better Arduino, I think this is a nano clone.

If I can get the Mouse usb to ps/2 adapter to work then I might see what is needed for a keyboard version.

Thanks for the help.
tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

No, this is not a Nano clone. Nano is a 8-bit AVR. Project requires a SparkFun SAMD21, which is a 32-bit ARM Cortex M0. It should be possible to make such adapter using Arduino Micro (ATmega32u4), but for sure it would require a lot of changes in the code. The entry level boards based on ATMega328P (Mini, Nano, UNO) are no-go, as they don't have a native USB support.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

That's what I thought.

Started looking for a suitable board but got distracted by forcing lubuntu to update to version 20.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

I guess it should be enough, but may require a change in pin mapping. It doesn't support 5 V logic, so it would require a level-converting circuit.

I was wrong about Arduino Micro (ATmega32u4) - it doesn't support USB Host mode, it could work only the other way around, and emulate the USB mouse, but you can't attach USB to it.
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

I've ordered one of these:

https://www.ebay.co.uk/itm/USB-SAMD21-M ... 2749.l2649

I've all ready ordered a level converter for between the ps/2 connections and the arduino.
joska
Hardware Guru
Hardware Guru
Posts: 5030
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Arduino experts

Post by joska »

tzok wrote: Sat Jan 09, 2021 5:09 pm The entry level boards based on ATMega328P (Mini, Nano, UNO) are no-go, as they don't have a native USB support.
There is a USB Host Shield for the 328/168 Arduinos that can be used for this. I have tested this myself (I actually make a USB keyboard/mouse/joystick -> IKBD adapter) but unfortunately the libraries has some issues with hubs.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

I didn't think of that. I know very little about the arduino so I am trying to stay close to the original so I have a chance to get it working.

My ps/2 wireless mouse failed so I wanted to get it going as soon as possible. However it started working again after 3 hours of fiddling about. No idea why but it did this several years ago.

My plan is still to get a usb wireless mouse to work with the Milan

If that works then I might make a second one to try a wired usb keyboard but I have no idea how this stuff works at the moment.

It would be nice to get a wireless usb k&m combo to work but that would use one wireless usb dongle so I don't know if it would be possible.
tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

joska wrote: Mon Jan 11, 2021 9:25 amThere is a USB Host Shield for the 328/168 Arduinos that can be used for this.
There is a shield, with own MCU, and embedded firmware. Not only it makes the device bigger, project more complicated, but the cost of a USB shield and Arduino Uno is much higher than the cost of Arduino SAMD and a level converter.
joska
Hardware Guru
Hardware Guru
Posts: 5030
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Arduino experts

Post by joska »

I did not say that it was the best solution, just wanted to show that this can be done with the classic 168/328 Arduinos too. And there is a "mini"-version of this shield, you can get all the parts you need for this project for €7 including shipping.

But a SAMD21 clone is almost as cheap and a more tidy solution.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
joska
Hardware Guru
Hardware Guru
Posts: 5030
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Arduino experts

Post by joska »

PeterS wrote: Mon Jan 11, 2021 12:16 pmIt would be nice to get a wireless usb k&m combo to work but that would use one wireless usb dongle so I don't know if it would be possible.
My old Arduino+USB host shield solution works perfectly fine with a wireless keyboard+mouse combo. That's a USB->IKBD converter so it will not work on the Milan though. And the IKBD implementation is minimal, the project halted when I ran into problems with hubs and was never finished.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
PeterS
Captain Atari
Captain Atari
Posts: 378
Joined: Fri Nov 09, 2007 1:53 pm
Location: England, GB

Re: Arduino experts

Post by PeterS »

Some of the parts arrived so time to start soldering.

I realised that an old wireless k&m combo I had in a box has the necessary ps2 plugs and small plastic box that I am hoping I can fit the adapter into.

The level converter I got looks like it is bidirectional, it has 5V and 3.3V pins, I am not sure it is strictly needed. The photo on github shows just a 5V I think.
tzok
Captain Atari
Captain Atari
Posts: 259
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: Arduino experts

Post by tzok »

PeterS wrote: Wed Jan 13, 2021 4:02 pm The level converter I got looks like it is bidirectional, it has 5V and 3.3V pins, I am not sure it is strictly needed. The photo on github shows just a 5V I think.
It's not required, but it won't hurt.
Post Reply

Return to “Others”