GHS_EV_team
Posts: 4
Joined: Sun Oct 12, 2014 3:09 am

Noise generation for electric vehicle

Sun Oct 12, 2014 3:22 am

Hello all! My school has put me in charge of the noise generation section of our electric vehicle (go-cart) project for a regional competition. As the vehicle accelerates it needs to sound as if the acceleration is coming from a petrol engine and not the small electric motor we are using, I am new to programming and was wondering about the best way to this with the raspberry pi that we have purchased. Possibly responding to a variable resistor or the voltage going through the motor? If so how would this be done?

Thank you,
GHS EV Team :D

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 4:45 am

I think that it's a mistake to make a quiet electric motor sound like an infernal combustion engine.
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

GHS_EV_team
Posts: 4
Joined: Sun Oct 12, 2014 3:09 am

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 5:13 am

I can understand that point of view and in many ways agree, however it is a part of the competition that must be completed, thanks.

User avatar
Jessie
Posts: 1754
Joined: Fri Nov 04, 2011 7:40 pm
Location: C/S CO USA

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 5:47 am

I'm sure it could be done with python, a pot, and a amp for the audio.
Jednorozec wrote:I think that it's a mistake to make a quiet electric motor sound like an infernal combustion engine.
Let's keep comments constructive please. He wants to know how to do something for a project for school.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 6:25 am

Perhaps investigate the sonic_pi package, which is installed by default with the latest version of the Raspbian Operating System.

http://sonic-pi.net/

http://www.raspberrypi.org/learning/sonic-pi-2-taster/

There is an example "Tron Bikes" which might be something you could adapt.

GHS_EV_team
Posts: 4
Joined: Sun Oct 12, 2014 3:09 am

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 8:37 am

Thank you kindly for your replies, I now have somewhere to start :D I will look into all the suggestions, once again, thanks.

GHS EV Team

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 1:41 pm

You need something that will generate pulses and use the RPi as a pulse counter.
Does the car already have a speed indicator of some sort? If so maybe you can tap into that?
Possibly something is available on the motor controller?
If nothing is already available then one option is a magnet on motor shaft or wheel and a reed switch.
Another option is to use LED and detector circuit.... Then something on the motor shaft to break the beam or mirrors etc.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Noise generation for electric vehicle

Sun Oct 12, 2014 5:46 pm

If your wheels have spokes then it'll be easiest with a playing card (or two) and a clothes peg.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 11:11 am

DougieLawson wrote:If your wheels have spokes then it'll be easiest with a playing card (or two) and a clothes peg.
Delightfully 'KISS'. :)
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 11:21 am

pluggy wrote:
DougieLawson wrote:If your wheels have spokes then it'll be easiest with a playing card (or two) and a clothes peg.
Delightfully 'KISS'. :)
And precisely what we did as kids.

There's even a megaphone version from toy shops.
http://www.turbospoke.com
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
r3d4
Posts: 982
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 12:31 pm

And that 'megaphone' could just as easily be a plastic bottle .
--
underground overground ...

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 12:40 pm

Not just for kids — certain VW cars have a “Soundaktor”, a speaker/amplifier behind the engine that makes fake ‘vroom vroom’ noises. No, really. I'm surprised no-one has made such a gizmo for Tesla drivers, as if you're going to drop that much $$$, you'd think a certain %age of the drivers would want it to bring the noise.

For the OP, you'll want to make a square wave of frequency roughly proportional to the speed of the vehicle. So you'll need a way to measure the vehicle speed (or the motor speed) rapidly, and generate a tone based on that value. If you're feeling really flash, you can add an accelerometer, and have the signal from that influence the volume. If you're feeling flash×10⁶, simulate gear-shifts with pitch shifts down at certain speeds.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 1:39 pm

scruss wrote:Not just for kids — certain VW cars have a “Soundaktor”, a speaker/amplifier behind the engine that makes fake ‘vroom vroom’ noises. No, really. I'm surprised no-one has made such a gizmo for Tesla drivers, as if you're going to drop that much $$$, you'd think a certain %age of the drivers would want it to bring the noise.

For the OP, you'll want to make a square wave of frequency roughly proportional to the speed of the vehicle. So you'll need a way to measure the vehicle speed (or the motor speed) rapidly, and generate a tone based on that value. If you're feeling really flash, you can add an accelerometer, and have the signal from that influence the volume. If you're feeling flash×10⁶, simulate gear-shifts with pitch shifts down at certain speeds.
You just have to spoil our fun with your clever science.
If you use a GPS receiver you'll get both velocity and acceleration from that.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 1:51 pm

scruss wrote:Not just for kids — certain VW cars have a “Soundaktor”, a speaker/amplifier behind the engine that makes fake ‘vroom vroom’ noises. No, really. I'm surprised no-one has made such a gizmo for Tesla drivers, as if you're going to drop that much $$$, you'd think a certain %age of the drivers would want it to bring the noise.
Also a safety issue due to ..... not so aware.... pedestrians being run over by electric cars because they could not hear engine noise.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
Burngate
Posts: 6302
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 5:15 pm

klricks wrote:Also a safety issue due to ..... not so aware.... pedestrians being run over by electric cars because they could not hear engine noise.
So you're saying it's up to the pedestrian to notice you and jump out of your way? And if they don't, it's there own stupid fault? Even if they're on their phone, or they happen to be deaf?

Or should we make it a rule that the driver avoids the pedestrian, whether or not they've seen or heard the car?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 5:58 pm

Burngate wrote: So you're saying it's up to the pedestrian to notice you and jump out of your way? And if they don't, it's there own stupid fault? Even if they're on their phone, or they happen to be deaf?

Or should we make it a rule that the driver avoids the pedestrian, whether or not they've seen or heard the car?
Remember we're corresponding with our American friends. Over there someone sued McDonalds for putting hot coffee in their cups without a warning "this cup contains hot coffee" and you have to explain to everyone about the image distortion effects of a convex mirror on the nearside of their car (the explanation "objects in (the) mirror are closer than they appear" is somewhat incorrect to anyone who understand the physics of mirrors, but who cares).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 7:12 pm

Burngate wrote:
klricks wrote:Also a safety issue due to ..... not so aware.... pedestrians being run over by electric cars because they could not hear engine noise.
So you're saying it's up to the pedestrian to notice you and jump out of your way? And if they don't, it's there own stupid fault? Even if they're on their phone, or they happen to be deaf?

Or should we make it a rule that the driver avoids the pedestrian, whether or not they've seen or heard the car?
I did not say that, but it is usually the driver gets the blame even if the pedestrian was at fault. What I was referring to is legislation to make noise generators mandatory for automakers....
http://en.wikipedia.org/wiki/Electric_v ... ing_sounds
http://www.dailymail.co.uk/news/article ... rians.html
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

nr.
Posts: 144
Joined: Wed Oct 03, 2012 8:51 am
Location: The Fens
Contact: Website

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 7:26 pm

Many years ago on a C64, one of the ways to make a kind of engine noise was just to turn the SID chip on then off again in succession. Each switch made a low-ish frequency click from the speaker - so you just reduced the delay between the clicks as you wanted to make a faster engine noise.

Sounded pretty rubbish to be honest - more like a farting whale in a vat of custard than an internal combustion engine.

There you go - next challenge - the Raspberry Pi "what's that farting in the custard?" sound challenge.
--
nr.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 7:35 pm

Having seen many of the forum posts by rbn it would be really good fun to use SonicPi to generate some sort of noises. Imagine an electric vehicle that played Rimsky Korsakoff's flight of the bumblebee in ever increasing pitch and volume.

I suspect SonicPi could be encouraged to produce some custard farting when driven by a specialist.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: Noise generation for electric vehicle

Mon Oct 13, 2014 9:06 pm

Burngate wrote:
klricks wrote:Also a safety issue due to ..... not so aware.... pedestrians being run over by electric cars because they could not hear engine noise.
So you're saying it's up to the pedestrian to notice you and jump out of your way? And if they don't, it's there own stupid fault? Even if they're on their phone, or they happen to be deaf?

Or should we make it a rule that the driver avoids the pedestrian, whether or not they've seen or heard the car?
I think that drivers have an obligation to help some pedestrians win a Darwin Award.
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Noise generation for electric vehicle

Tue Oct 14, 2014 1:20 am

DougieLawson wrote:I suspect SonicPi could be encouraged to produce some custard farting when driven by a specialist.
I must be quite the specialist, then. Every time I'm faced with a generational music program or an analogue synth, on the very first try I always get a squelchy, farty sound.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

GHS_EV_team
Posts: 4
Joined: Sun Oct 12, 2014 3:09 am

Re: Noise generation for electric vehicle

Tue Oct 14, 2014 3:37 am

So the idea thus far is to use Sonic Pi for the noise generation and have this responding to speed (and accelerometer?) or GPS... Could it instead be hooked up to an ammeter and have it based on current, producing noise based on current? How could all this be done? Where can I find resources to learn the programming?

GHS EV team

P.S.
Could Tron bikes from Sonic Pi (credit to B.Goode) be used as say a template for the rest of the project or to start?
Here it is;

Tron Bikes

loop do
with_synth :dsaw do
with_fx(:slicer, phase: [0.25,0.125].choose) do
with_fx(:reverb, room: 0.5, mix: 0.3) do
start_note = chord([:b1, :b2, :e1, :e2, :b3, :e3].choose, :minor).choose
final_note = chord([:b1, :b2, :e1, :e2, :b3, :e3].choose, :minor).choose

p = play start_note, release: 8, note_slide: 4, cutoff: 30, cutoff_slide: 4, detune: rrand(0, 0.2), pan: rrand(-1, 0), pan_slide: rrand(4, 8)
control p, note: final_note, cutoff: rrand(80, 120), pan: rrand(0, 1)
end
end
end
sleep 8
end

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Noise generation for electric vehicle

Tue Oct 14, 2014 4:06 am

GHS_EV_team wrote:So the idea thus far is to use Sonic Pi for the noise generation and have this responding to speed (and accelerometer?) or GPS... Could it instead be hooked up to an ammeter and have it based on current, producing noise based on current? How could all this be done? ......
The RPi does not have any type of analog input so you would have to have an analog to digital converter..... But current is likely to be non linear. More current will be used starting out or going up hill etc........... so it would be a difficult task to figure out how to code that to get a true representation on speed from current.
Much easier to to the magnet/reed switch or LED/ Detector method.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
cyrano
Posts: 714
Joined: Wed Dec 05, 2012 11:48 pm
Location: Belgium

Re: Noise generation for electric vehicle

Wed Oct 15, 2014 11:43 pm

Sonic Pi can generate motor noise, since it can also use samples.

And your electric motor is controlled by either a PWM signal or an analog voltage (0-5V). That's the signal to use. Measuring amps won't be too easy because of EMK.

After playing around for an hour or so, I haven't found a way to input that signal into Sonic Pi. Midi?


Return to “General discussion”