TheDIYGuy999 / Rc_Engine_Sound_ESP32

Allows to play vehicle engine sounds on an ESP32. Additional sounds can play in parallel with the engine sound! Controls your lights as well. compatible with SBUS, IBUS, PWM, PPM and SUMD signals.
https://www.youtube.com/watch?v=s93yAAmEtbM&t=3s
297 stars 119 forks source link

Simple ESP32+PAM8403+FS-IA6B no sound #60

Closed Radh62 closed 1 year ago

Radh62 commented 1 year ago

Dear Sirs, owner and contributors, Thank you for your fine activity on RC sound modules! After a succesful implementation of your Arduino based RC sound module on a G scale Steam locomotive (with my own sounds and tweaks), an attempt to use an ESP32 based sound module was made. Just the ESP32 board (without the shield from PCBWay, nor other), the PAM8403 amplifier and a receiver (FS-IA6B with Flysky - I6 transmitter) in the prototypical layout (the project requires relatively small dimmensions and physical flexibility). Since I want to use the board with receiver's PWM signals, I commented all #defines in communication section, kept the Flysky definition on remote.h and activated by uncommenting the autoengine on_off. I put throttle signal CH3 from the receiver to pin 13 and signal CH2 from the receiver on pin 12 (like in your pictures). Pins 25 and 26 were connected to PAM8403 like in Readme.md. The code uploaded OK with the recommended settings (no errors), but there is no sound when the throttle or horn are activated. I get only a repetitive weak "scratching" noise synchronous with the blinking LED (and I guess the blinking should not be active). Power LED (the other, not blinking LED) is lit OK. I scoped the throttle signal connected to ESP board and is normal and clean at approx. 3.3V which means that pins 12 and 13 are on input state (high impedance). Then another ESP32 board was tested with the exact same result. The serial monitor returns random characters (on 9600 baud and several other rates) for both boards. A helping hand to push me on the right path would be very much appreciated since I do not know what to do anymore, I'm not skilled with programming and I very much like the project. Best regards!

Radh62 commented 1 year ago

I come again to add the fact that on 115200 baud, the message on serial monitor is "CH1 out of calibration range, check transmitter & receiver" (discovered that 15 minutes ago, sorry for misleading!). It seems that I should do something to get rid of the autocalibration on other channels than CH2 and CH3 on the receiver, by modifying the programme, or I should connect all 6 channels to the soundboard PWM input pins 12, 13, 14, 27, 34 and 35. Or I'll define only 2 channels and only 2 input pins in "#define PWM_CHANNELS_NUM 6". I'll conduct some more research and maybe make all things work.

TheDIYGuy999 commented 1 year ago

Hi, please read the comments in this file carefully: https://github.com/TheDIYGuy999/Rc_Engine_Sound_ESP32/blob/master/src/2_Remote.h image In general I recommend to use IBUS with your receiver. The transmitter needs to be configured according to: https://github.com/TheDIYGuy999/Rc_Engine_Sound_ESP32/blob/master/documentation/adjustmentsRemote.xlsx

For a locomotive use "vehicles/Adler.h" as an example. It includes #define STEAM_LOCOMOTIVE_MODE, which is important. Hope this helps