"It didn't work" is not a thesis.
However, "this is what I made, this is how I tested it, these are the results of those tests, this is how I attempted to fix/would attempt to fix in the future", etc, can be just fine, even if the ultimate conclusion is that your device isn't currently functional.
Undergraduate theses are typically fairly short-term projects, so you may not be able to follow up with all the avenues you would have for a longer project.
Most importantly, though, talk to your supervisor. Their role as a supervisor is for exactly the situation you're in: applying their experience and expertise as a researcher to help guide you in what to do. If everything worked out perfectly without any kinks or setbacks a supervisor would hardly be necessary.
Also most importantly (I'm running out of superlatives here), as a student, the success/failure of the endeavor should be primarily judged on what you as the student have learned along the way rather than the overall outcome (the proverbial "it's the journey not the destination"). Your device may not be working, but if you've learned something along the way I would not say the project is a "failure".