Custom "engine" sounds (or sweet silence) with a DIY replacement VSP controller

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
@dampkwab if you really want this project to fly, I encourage you (perhaps once you've recouped your development cost selling a few units) to make your PCB design, BoM and 3D case files open source! Just sayin :)

And not wanting to beat the same old drum, but I really think an on-board piezo or connections for an internal cabin speaker would be great. It could create the indicator tick/tock noises and other combination-meter warning noises that people loose when they remove the piezo from their cluster like driving without the seatbelt on (lol, ok maybe not that one)
 
Definitely planning to keep the firmware open-source in case anyone wants to customise that. I kinda figured the hardware designs wouldn't be much use to anyone unless they're planning a production run, but I'll keep it in mind!

Agreed on the idea of an on-board buzzer - that would make it a lot more versatile & could potentially be used for user feedback when adjusting volume/sound/etc settings too. The first run of prototypes does include an expansion connector that breaks out a few PWM-capable GPIO pins. I was planning on using those for the option of adding aftermarket mute/volume controls, but a speaker/buzzer could be plugged in there just as easily.
 
I received the PCBs & enclosures this week! All worked well once assembled (after a tiny bit of manual persuasion for one of the ICs)
PXL_20250104_093705048.jpg

And here it is safely encased in its laser-sintered nyon enclosure:
PXL_20250104_093334357.jpg

I've been working on the firmware & running it through its paces on a benchtop test harness:
PXL_20250104_094546247.jpg

The plug on the left simulates the vehicle connection - providing power, speaker output, mute button, and driving signals over USB2CAN. The plug on the right allows an three additional buttons for adding optional aftermarket volume/mute controls. (Or something else if you're into firmware hacking)

Everything looks pretty good so far! I'll be running it in my car to give it a bit more field testing & putting some finishing touches on the firmware, but I'd say v1 is pretty close to finalised.
 
Update on availability & new sounds:

It's been running smoothly in my car for the last month now, so I think its ready for a wider audience.
There are already a couple on their way out to other forum-goers, and I'm opening up orders to anyone who wants one of their own!
More details & an order form can be found here:
https://meadia.com.au/leafy-warbler/

In addition to the original synth mode I've added the ability to playback arbitrary recordings, so far including:
  • Idling 2-stroke chainsaw motor
  • Coconuts (pantomime horse) that gallop faster as the car speeds up
  • Pac-Man jingle on startup, waka-waka when the car moves, game-over sound on shutdown 😁
The firmware repository has been updated too, so people can recompile it to add whatever other sounds they like.
Keen to see what people come up with!
 
Very excited to load up Forest Speederbike sounds.
Do ZE0 cruise control buttons work, or only ZE1?

I suppose some volume adjustment could be baked into a custom firmware build.
Gitlab is blocked by my ISP, but working around that with VPN and/or cellular hotspot.
Edit: Spent a few hours last night solving build issues, but got it compiling on a Pixelbook Go (Intel m3 x86) and used ffplay to preview the sound samples. Next I'll continue reading over the code and prepping additional new audio samples.
I might want to wire a button to switch sound profiles.
Some persistent memory can be written to record the last selected profile, and flush/write during power down if it's changed.
https://github.com/raspberrypi/pico-examples/blob/master/flash/program/flash_program.c
https://www.makermatrix.com/blog/read-and-write-data-with-the-pi-pico-onboard-flash/
 
Last edited:
For ICE cars, they came up with the SoundRacer, which plugged into the cigarette lighter socket, and would synthesize a V-8 engine over its FM transmitter, so you could tune in and play racing engine sounds over the radio.

I often thought it would be fun to have something like that for the Leaf that could synthesize engine sounds like they had on the Jetsons. Now it looks like that may be an option? Very cool!
 
Do ZE0 cruise control buttons work, or only ZE1?
Only ZE1, as far as I can tell.
I haven't been able to find any mention of the earlier buttons being available on the CAN bus & I don't have an AZE0 of my own to reverse-engineer.
But if anyone knows of a AZE0 CAN frame that exposes those buttons please let me know and I'll add it to the firmware!

For ICE cars, they came up with the SoundRacer, which plugged into the cigarette lighter socket, and would synthesize a V-8 engine over its FM transmitter, so you could tune in and play racing engine sounds over the radio.
Love this - inferring engine revs by listening to alternator voltage ripple from the cigarette lighter is genius!
 
Edit: Spent a few hours last night solving build issues, but got it compiling on a Pixelbook Go (Intel m3 x86) and used ffplay to preview the sound samples. Next I'll continue reading over the code and prepping additional new audio samples.
I might want to wire a button to switch sound profiles.
Some persistent memory can be written to record the last selected profile, and flush/write during power down if it's changed.
https://github.com/raspberrypi/pico-examples/blob/master/flash/program/flash_program.c
https://www.makermatrix.com/blog/read-and-write-data-with-the-pi-pico-onboard-flash/
Just saw this edit - hope it wasn't too difficult to get up & running!

Settings are already saved to persistent memory, so it'll save whether it's muted & what sound/volume it's set to whenever they're changed.
You can find the code for that in src/settings.cpp.

That'd also be the place to put any custom button logic you want to add.
E.g. if you want button 1 to select the coconuts sound, you could comment out its existing logic (cycle through all sounds) and add something like:

C++:
// Dedicated coconuts button
if(debounce( gpio_get(PIN_BTN_1), btn_1_debounce )){
    settings.mode = MODE_COCONUTS;
    changed();
}


The quick & dirty way to add a custom sound would be to replace one or more of the existing raw audio files (in sounds/) and recompile, no coding required.
Otherwise, relevant code can be found in src/sampler.cpp and I'd suggest copying one of the existing sampler modes as a template and customising it from here.

There's not a lot of documentation in the code yet, so let me know if you run into anything confusing and I'll try to improve it or explain it better!
 
Last edited:
Back
Top