|
Post by spetersen on Jan 12, 2020 19:50:46 GMT
You could add a 1k ohm resistor inline between the 200 and the input, although the opto is listed as tolerant of 30 ma, and is only drawing 15.
with the resistor added, it basically becomes the same as the schematic I provided
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 17, 2020 23:17:46 GMT
|
|
|
Post by spetersen on Jan 18, 2020 4:17:03 GMT
You can adjust the timing in the program, for better accuracy also
#>>>these constants can be changed to fit the characteristics of your wallbox MAXMIMUM_GAP=2 MINIMUM_PULSE_GAP_WIDTH=0.014 <<<--------- this number affects the accuracy of the decoding of the pulses, raise or lower and check if it works better LETTER_NUMBER_GAP=0.2
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 18, 2020 16:07:04 GMT
Having the mechanical relay (it has a built in opto with limiting resistor on the opto) and having it set for low trigger has helped immensely. I rarely got the right selection before with just the opto. Even with the relay set to trigger on high it was still more error prone than low trigger, and I don't have to funnel 5v into the wheel contacts either. It works on ground now like it did originally and seems to work much better that way.
|
|
|
Post by spetersen on Jan 18, 2020 17:13:25 GMT
I'm happy to hear you are close to perfect in decoding the pulses, It has been a long road getting there. Currently I get maybe 1 error in 100 plays, mostly after sitting a while. I just bought a AMI WR200 for my next unit, it'll be interesting as to what pattern it will generate for the selections, waiting for a key...
|
|
|
Post by spetersen on Jan 20, 2020 13:19:52 GMT
Is it playing music yet? I am going to make some minor changes in the system structure so that the system will boot without the USB installed and alternately blink the red and blue LED's, I sold one of my boxes to a friend who knows almost nothing of computers, and I told him he should back up the USB and test it, He was not able to make a backup. Since the Pi will not boot without the USB There are no diagnostics available.
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 20, 2020 20:22:29 GMT
Not yet. Working on making everything work together right now. I'm currently having a problem with the GPIO. When the pulse train is coming in on GPIO1 I'm reading enough events on GPIO2 that it looks like the coin drops are getting triggered when they're really not. Not sure what's going on yet.
|
|
|
Post by spetersen on Jan 20, 2020 20:34:59 GMT
Try putting a small cap (.01) across the coin drop input and ground to screen out noise, I had the same issue with the skip song input on mine. If you are using edge triggered on the coin input, that will also make it overly sensitive to noise.
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 20, 2020 21:31:59 GMT
I was talking with their support, they suggested a 1k ohm resistor from the input to ground on the basis that it might be crosstalk. I can order some of both as I don't have either.
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 20, 2020 22:07:24 GMT
I started with high triggered and was having issues so I switched to edge triggered, but using debouncing and checking to make sure I have a high edge and low edge together in under .5 seconds and a reasonable gap between high and low edges. Still seeing problems though.
|
|
|
Post by spetersen on Jan 21, 2020 1:24:39 GMT
The coin drop is basically the same logic as the skipsong program, except for the gpio pin and the result
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 23, 2020 1:41:02 GMT
Neither the cap nor the resistor worked. If anything they seem to have made it worse. I'm thinking I might be better off either using another relay (I have 4 more) or trying to rework the coin drop to trigger low on ground.
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Jan 23, 2020 2:31:01 GMT
Never mind my last post, I had a grounding issue while I was testing. I might still try the relay to fully insulate the Pi from the mechanical noise but it is working better with the resistor. The cap didn't make any difference. When I was hooking up the resistor I was able to make the board trigger just by touching the bare wire of the resistor, so I do think I'm on the right path.
|
|
|
Post by spetersen on Jan 30, 2020 21:38:30 GMT
Any news?
|
|
ScotK
Full Member
Posts: 113
|
Post by ScotK on Feb 8, 2020 20:43:50 GMT
Yep, quite a bit to update on although I haven't had much time to work on it in the last 2 weeks. Most of that time has been spent trying to get the bluetooth connection working. No success there yet. Hardware wise, I have everything assembled. I added a 1k resistor between ground and the coin drop switches on the Pi side of the coin drops to get rid of the electrical noise which resolved that issue. I've got the volume buttons working, but I think I need to contact the manufacturer and ask if they have any idea why the voltage readings are varying so widely on the analog input. The voltage reading is swinging by 1 volt or more fairly often, and sometimes reading 0.02 volts, which I doubt or the Pi wouldn't still be able to function. The digital multimeter doesn't show any variation at all. The voltage value read from the Pi swings enough that it makes it difficult to use that value for the volume selection. To make it work I have to sample it every .25 seconds watching for a change, then read the same change 5 consecutive times at .10 second intervals before I adjust the volume. It normally registers the change within 1-2 seconds so it does work but not as well as I had hoped. It hasn't (yet, anyway) registered any false volume changes yet doing it this way. I'll let it be this way for a while, if it doesn't work well long term I'll just separate the volume grounds and use the volume controls directly. I've purchased a 6 foot fabric wrapped cord and routed it out through the existing holes in the bottom where the old wires to the jukebox would have gone. The Pi's SD memory card is set to read only so it should keep it working long term with minimal to no wear. The songs are stored on a separate 128 gig USB drive and the credit and song selection files are stored on a RAMDISK so they are wiped and created fresh by the keyboard and coin drop programs every time power is turned on. Now I can simply pull the plug anytime I want to turn it off. I need to work on cleaning the pulse train contacts a bit yet before I put the case on but otherwise song selection works well and hardware is done. I've attached a few photos with everything assembled. The first shows with the song catalog mounted, the second is without the song catalog, and the third is a front-top down view showing how I've packed everything in: - The 5vDC 10 watt amp is directly behind the left speaker and is directly connected to both speakers
- The 24vAC & 5vDC fuses are directly behind the volume buttons, as is the relay for pulse train (relay is blue with a red circuit board).
- The 5vDC power supply is about the same size as the song selection relay and is not visble in the photo. The pulse train relay is mounted to the top of the power supply and covers 90% of the power supply from the top view.
- The 24vAC transformer is mounted behind and just left of the right speaker, and takes up space that the APU would normally require. I used an existing APU mounting hole to mount the 24vAC power supply as it's too heavy to use foam tape.
- The 5vDC Raspberry Pi 3b is mounted on the back wall where the APU11 would normally be.
Software wise I've gotten everything working. I have 4 programs that run on system start: 1. Coin drops: sums the number of credits to a file, and turns on the credit relay and hood lights when coins are dropped. 1 coin of any kind=10 credits currently (python) 2. Volume button: reader/setter (python) 3. Keyboard reader: outputs song selections to a file, turns on album selection light relay when running (using your python code) 4. Player: reads selections from a file, looks for any file in the corresponding letter+number folder and plays them, and after last credit is spent it turns off the credit relay and the hood lights (Visible indication of credit depletion) Still to-do: 1. Songs & title strips 2. Bluetooth (Won't connect to anything, haven't figured out why yet. I may try a USB bluetooth dongle that I know works well under Linux to see if that makes any difference.) 3. TV Remote (not started yet) The list is getting shorter!
|
|