Star Trek thingy

My beach buddy, she who must not be kept waiting, is rolling towards me. So I'm off soon.

But I did get @Delta_G's code running


Wokwi_badge @Delta_G' code from the repo


I used pulled up switches so I changed the sense on the digital readings on the buttons.

I have not checked and double checked the wiring. Some more labels when I am back.

Anyone can use the simulation; you'll get your own copy to mess with.

a7

But why? If your code sets the output you read later at an input, can't you just use a variable to know what you would be reading if you did?

Perhaps if you said where this line of inquiry is heading it would nake sense.

a7

The purpose is to remove the push button switches and make the sketch totally autonomous as this model will be hung from the ceiling and used a motion detection alarm.

I see. Something made me think you were hooking up an output to an input.

If you want to replace the pushbutton with anything else that will make it go, about the only small detail is whether "go" is a HIGH or LOW from the device, like an RF people detector or PIR module.

a7

OK, for the sake of argument I will explain the premise of the entire circuit design. I assume you are familiar with the Bareduino? The circuit will be supplied with power from a 1400-1500mAH rechargeable battery pack similar to the emergence back battery packs for cellphones. The power circuit will incorporate the PIR sensor and supply power to the microprocessor when activated there by turning on the AtMega328P. All the standard lighting comes on and an audio
program runs. The ship is in impulse mode and the captain says something like "Red alert, battle stations, shields up, charge all weapons! Ahead warp factor 2."The impulse engines fade out and the warp engines come on line. at some the captain issues commands to fire weapons in some combination and you see and hear the weapons being fired. Now this where the deletion of the push button switches come in to play. If the switches have to manually activated it kind makes this all being a motion sensor alarm a moot point. Maybe a second PIR sensor could be incorporated to control the weapons systems, if there is still motion detected the commands to fire and audio continue to loop back through this part of the sketch until no motion is detected and then the ship returns to impulse and the circuit powers down. at some point something could done using two ships, ie.. the Enterprise and a Klingon Battle Cruiser for example, both battling back and forth, just a thought. I was thinking the best location for the PIR sensors might be in the bussard collectors since they are forward facing.
Now, what are your thoughts on this?

Keeping in mind that I am not sure how the LEDs in the bussard collectors may affect the PIR sensors.

Oh, I almost forgot, I am using a PAM8403 amplifier for the audio portion of the circuit. And I thought I had explained all of this, but we did say one step at a time, lol.

OMFG, ALL of my 3MF files disappeared! I was going to upload a sketch of the bussard collectors showing positions of all the components locations and they are now just gone!

The PAM8403 is a class D stereo amplifier. The WAV files would be contained on an SD card reader. So I guess it would be a combination of both.

Ok, I think I found my files

No, the arduino sends the audio signals to the PAM which drives the speakers for the sound effects. The arduino only determiners which sound effects are played from the SD card. Does that make sense? Sorry its my 6th straight day at work and I have one more day left and I guess its starting to catch up.

Most of my audio files are from TOS, I have an audio sequence from the motion picture, the dry dock start up exit sequence. But I am still doing some searching for really good audio sequences for this. I have some audio clips from "The Enterprise Incident", "Balance of Terror", "The Ultimate Computer" and "Elaan of Troyius".

Normally the L/R channels are connected to two PWM pins and ground and the L/R output to two speakers and ground. But i was thinking why can't it be connected to two analog pins and ground and the speakers.

As for the PIR sensors and again if you are familiar with the bareduino and its power circuit , I was planning on replacing the power switch with a PIR sensor. Originally I thought from there the whole sketch would be controlled through programing, but after your suggestion about controlling the weapons using a PIR sensor that sounded good. So then I started thinking that as long as motion is still be detected it would continue a loop through the weapons systems. Once motion has stopped the command to resume course and to destination would bring the ship back to impulse and shut down.

I need to the photos, schematics and videos posted. Its been difficult only because of the time I have after work. I am now on vacation for two weeks roughly, 12 days actually. I have been trying to get a hold of my hand surgeon since the beginning of the year to schedule my carpal tunnel surgery.

So this is the plate housing the LEDs and PIR sensor

And I need to reprint this, two keep falling out and the alignment is off. I had to drill out the holes for the 3mm LEDs.

Its printed in silver PLA and I was thinking I cover the top surface with foil tape to give it a more reflective surface.

Ok, so this is a video of the original sketch narrated. WOW, I can't upload the video, I'll figure it out.

I am going to try to upload a video of your sketch un-narrated. I can't do that either, but again I will figure it out.