H.A.R.D. Hack 2023 (hardware hackathon at UCSD) progression video

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ก.ค. 2023
  • It took us some time to start because we had to get the materials, and we wanted to attend some workshops from the sponsors and go on the roof of Atkinson Hall.
    On Thursday, before the hackathon, they hosted a workshop presenting the Infineon PSoC board. We saw its buttons and slider and decided that we wanted to make a rhythm game out of it.
    Molly worked on the EMG wristband. It has four pennies with the copper plating sandpapered off, and when attached to the arm, it measures the slight difference in electric potential down your arm at two different points. It fluctuates depending on how you move your arm, but the way it fluctuates is complicated. The sponsors believe that it requires machine learning and is out of the scope of the hackathon. Instead, because the measured voltage is in microvolts, they want you to build an amplifier circuit, and they weren't confident that it could be finished before midnight. But we saw the wristband as another game mechanic for the rhythm game, where in addition to pressing buttons you also had to clench your fist at certain times.
    David brought a monitor and FPGA, and since he had them, he wanted to use them. While it didn't have speakers to play the rhythm game audio, he wanted to draw the rhythm game on his screen, and so he set out to write his own GPU on the FPGA in System Verilog. Luke worked on the actual program that would call GPU methods to draw the game; I think it was written in C.
    I got the Infineon board and used the starter C code (from the workshop) that set the LED brightness based on the buttons and slider. I adapted it to print its sensors. I used PuTTY to read the output from the board, but it was reading garbage at first. After comparing another example that printed to the PuTTY terminal, I realized that I had to enable some debug mode, and it worked.
    David's vision was to connect the Infineon board directly to his FPGA, and they would interface with each other using SPI, whatever that is. I found examples for the Infineon board for SPI, but it always hung the board whenever I tried running it, maybe because as the SPI "slave," it was waiting for its "master," the FPGA board, to acknowledge it or something.
    Since I was blocked by David's GPU, I decided to put my web skills to use by doing the graphics in HTML/CSS, which I am most familiar with. So I wanted to have a web page that can somehow access sensor data from the Infineon board. My first approach was to make a Node web server that could access the USB ports, then forward that data over a WebSocket connection to the browser. However, I found out that WSL 2, which I was using to run Node, cannot access USB ports. I installed Node on Windows itself, but the npm serialport library kept giving an "unknown error code 3" error. I tried running cmd.exe and PowerShell from WSL. cmd.exe had a "type" command, but it read large chunks at a time, so it would wait until enough bytes were read rather than outputting sensor data in real time. PowerShell worked, but if a PowerShell session ends without closing its lock on the port, future sessions cannot access the USB port unless I unplug the USB.
    But then I discovered the Web Serial API. Apparently, the web page itself can directly access the USB port, and it worked amazingly well. I was able to receive sensor data in real time with unnoticeable latency, and I could focus on making the graphics for the game itself. I made a JSON format for representing level data and had Luke design the level while I finished up the graphics.
    We stayed to 2 am for free boba. By then, Molly had her wristband somewhat able to detect fist clenching. Luke had most of the level designed, and I was almost done with the game functionality. We returned to our dorms to sleep.
    In the morning, towards the end of the hackathon, Molly's wristband suddenly stopped working, so she gave up. We focused on the web game itself.
    The website works pretty well. With the program that outputs sensor data to the console loaded on the Infineon board, you can unplug it from my laptop and plug it into anyone else's laptop, and they can give the web page access to the board. It works just like a game controller. I can host the web page on GitHub Pages, and it doesn't require a server backend to be running.
    Because you don't have the Infineon board we used, I have a version of the game that uses the keyboard and mouse instead:
    sheeptester.github.io/hello-w...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 1