MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Theremin project problem

Wed Aug 28, 2019 9:00 pm

Hi all, we've just bought our first Pi (a 3), to build a theremin using ultra sonic distance detectors. We've done the wiring etc as the project instructs and input the python code. However, when run we get the message that no echo has been received. The project says we should be using Python 3 IDLE. This is not in the main menu, the only option is Thonny, could this be the problem?

cmrincon
Posts: 44
Joined: Thu May 24, 2018 7:39 pm

Re: Theremin project problem

Thu Aug 29, 2019 7:18 am

Did you wire everything right? Probably the error you get is because you made a mistake wiring the conections, the sensor isn't properly power or resistor values are wrong

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Theremin project problem

Thu Aug 29, 2019 7:33 am

Without seeing the project instructions and what you have done, any suggestions as to why it is not working are 100% guesswork.

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

Re: Theremin project problem

Thu Aug 29, 2019 7:46 am

drgeoff wrote:
Thu Aug 29, 2019 7:33 am
Without seeing the project instructions and what you have done, any suggestions as to why it is not working are 100% guesswork.


Inarguably correct.


But an 'intelligent guess' might lead us to the Ultrasonic Theremin project published by Raspberry Pi themselves, which unfortunately does contain a reference to Python3 (IDLE) here - https://projects.raspberrypi.org/en/pro ... theremin/5

That is a problem in itself even if not the documentation in this particular case. I have sent Feedback and flagged this post for Moderator attention.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 7:50 am

Yes, sorry I should have clarified. The project is the one in your link.
I have triple checked the wiring and all seems correct. I have ordered more resistors in case the ones I have are wrong, (can't seem to verify the rating using the colour code).

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

Re: Theremin project problem

Thu Aug 29, 2019 7:58 am

MarkMalone wrote:
Thu Aug 29, 2019 7:50 am
Yes, sorry I should have clarified. The project is the one in your link.
I have triple checked the wiring and all seems correct. I have ordered more resistors in case the ones I have are wrong, (can't seem to verify the rating using the colour code).

Have you tested the basic operation of the sensor using the short 6 line test on the page I linked?

Is your breadboard exactly like the one shown

Not divided up like the one here: https://www.raspberrypi.org/forums/view ... 14#p635787

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 8:22 am

We've only got as far as the first test code, that's when we get the error message rather than the distance reading.
I'll double check the wiring when I get home but I think it's correct.

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

Re: Theremin project problem

Thu Aug 29, 2019 8:28 am

MarkMalone wrote:
Thu Aug 29, 2019 7:50 am
I have ordered more resistors in case the ones I have are wrong, (can't seem to verify the rating using the colour code).


A 330 Ohm resistor may be marked Orange Orange Brown

A 470 Ohm resistor may be marked Yellow Violet Brown


Online 'calculators' are available, for example https://www.allaboutcircuits.com/tools/ ... alculator/
(The one linked has options for 4/5/6 band markings.)


Edit: modified to reflect variance in the number of marking bands.
Last edited by B.Goode on Thu Aug 29, 2019 9:13 am, edited 1 time in total.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 8:31 am

LOL, to be honest I think the problem is my eyesight! The colour bands are too damn small!

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Theremin project problem

Thu Aug 29, 2019 8:49 am

B.Goode wrote:
Thu Aug 29, 2019 8:28 am
MarkMalone wrote:
Thu Aug 29, 2019 7:50 am
I have ordered more resistors in case the ones I have are wrong, (can't seem to verify the rating using the colour code).


A 330 Ohm resistor will be marked Orange Orange Brown

A 470 Ohm resistor will be marked Yellow Violet Brown


Online 'calculators' are available, for example https://www.allaboutcircuits.com/tools/ ... alculator/
I'm seeing 4 band value markings more often now than years ago. A 330 ohm could be orange orange black black. And 470 as yellow violet black black.

Both the 3 and 4 band versions will have an additional band for the tolerance.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26677
Joined: Sat Jul 30, 2011 7:41 pm

Re: Theremin project problem

Thu Aug 29, 2019 10:28 am

B.Goode wrote:
Thu Aug 29, 2019 7:46 am
drgeoff wrote:
Thu Aug 29, 2019 7:33 am
Without seeing the project instructions and what you have done, any suggestions as to why it is not working are 100% guesswork.


Inarguably correct.


But an 'intelligent guess' might lead us to the Ultrasonic Theremin project published by Raspberry Pi themselves, which unfortunately does contain a reference to Python3 (IDLE) here - https://projects.raspberrypi.org/en/pro ... theremin/5

That is a problem in itself even if not the documentation in this particular case. I have sent Feedback and flagged this post for Moderator attention.
Docs in this area are currently being triaged and fixed as necessary.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 11:13 am

Ah, so it might not be me? Good to hear.
Do you know of a rough timescale?

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

Re: Theremin project problem

Thu Aug 29, 2019 11:16 am

MarkMalone wrote:
Thu Aug 29, 2019 11:13 am
Ah, so it might not be me? Good to hear.
Do you know of a rough timescale?

I don't/can't speak for RPF/T or the Moderator, but I think it was the reference to using the obsoleted IDLE IDE that was being referred to.

That doesn't sound directly relevant to the 'echo' issue you encountered.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 5:17 pm

Wiring is checked, breadboard checked and resistors are confirmed as correct.
Still getting this message when trying the first bit of code which just measures the distance.

/usr/lib/python3/dist-packages/gpiozero/input_devices.py:997: DistanceSensorNoEcho: no echo received
warnings.warn(DistanceSensorNoEcho('no echo received'))

any help would be much appreciated, getting a bit despondent

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

Re: Theremin project problem

Thu Aug 29, 2019 6:30 pm

MarkMalone wrote:
Thu Aug 29, 2019 5:17 pm
Wiring is checked, breadboard checked and resistors are confirmed as correct.
Still getting this message when trying the first bit of code which just measures the distance.

/usr/lib/python3/dist-packages/gpiozero/input_devices.py:997: DistanceSensorNoEcho: no echo received
warnings.warn(DistanceSensorNoEcho('no echo received'))

any help would be much appreciated, getting a bit despondent



Just breaking into the bits box to find the parts needed to check with..


Update: works for me as documented in the Raspberry Pi Project as discussed.

Using Thonny as the Editor/IDE and as the environment for running the script.

A screen grab from the 'Shell' window at the bottom of the Thonny screen -

Code: Select all

Python 3.7.3 (/usr/bin/python3)
>>> %Run hrs04test.py
0.4533149914118337
0.4466732536674124
0.4468253178587747
0.4500790794082377
0.45268922843493553
0.44666450055193196
0.4515897666529895

Check that the order of the 4 annotated pins on the sensor is the same as in the Project. And also that you have the sensor oriented in the breadboard correctly. (Because obviously the connections change if you rotate the sensor... )

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 7:38 pm

I've used jumper cables to connect the sensor and checked all the order.
Your result is what I would expect to see but I', still getting the no echo warning
Have I screwed up the code, it seems fairly straight forward:

from gpiozero import DistanceSensor
from time import sleep

sensor = DistanceSensor(echo=17, trigger=4)

while True:
print(sensor.distance)
sleep(1)
I don't know if it relevant but the text colours are different from the screen shot on the project, ie "True" and "1" are in orange in the project text but purple in our shell.

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

Re: Theremin project problem

Thu Aug 29, 2019 7:44 pm

You are not using the same Editor, so I would not find it surprising if the colourisation was different.

For me, using Thonny, the keywords are purple and the numbers are orange.


My hunch is that this is a wiring problem, not coding. Your script must be getting as far as the command to read the distance, otherwise it couldn't give you that error message.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 7:48 pm

I'm using Thonny too, and all my numbers are purple.
maybe I'll get some new wires, I've already tried a new breadboard.
Thanks so much for helping.

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

Re: Theremin project problem

Thu Aug 29, 2019 8:55 pm

I've been mulling this over as a 'background task'.

There isn't much in the wiring that you can afford to get wrong without it affecting the circuit. But since you've already mentioned identifying them as an issue, the respective positions of the two resistors is probably critical. Having them reversed might prevent the resulting echo signal passed to the gpio pin from being strong enough to be detected.

You need a ground connection, and a permanent power connection. The trigger input to the sensor is driven directly from a gpio pin. The echo output from the sensor is too powerful for the gpio input pin on the RPi, so has to be reduced by the two resistors before being connected back to a gpio pin.


And to emphasise again that divided red/blue rails on the breadboard can cause a problem.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Thu Aug 29, 2019 9:00 pm

I've been over it all a bunch of times, including the resistors, can't spot anything untoward.
I'm using the 5v supply from the Pi and the ground.
Using a breadboard with continuous lines and keeping the wires next to each other.
Proper chin stroker this one.

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Fri Aug 30, 2019 8:58 pm

Hmm, I just tried a different version of this project using new sensors, wires, circuit and Mu instead of Thonny and got the same result. Could there be something wrong with Python on my Pi?

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Sun Sep 01, 2019 8:26 pm

Right, solved that problem, seems that the resistors were crap, replacements work fine. However, it appears the code needs Sonic Pi 3 to work. I've tried to upgrade but it says we have the latest version (2.1). Can we not run Sonic Pi 3 on a RPi 3?

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

Re: Theremin project problem

Mon Sep 02, 2019 9:20 am

MarkMalone wrote:
Sun Sep 01, 2019 8:26 pm
Right, solved that problem, seems that the resistors were crap, replacements work fine. However, it appears the code needs Sonic Pi 3 to work. I've tried to upgrade but it says we have the latest version (2.1). Can we not run Sonic Pi 3 on a RPi 3?


Ref: https://www.raspberrypi.org/forums/view ... 2#p1503116

MarkMalone
Posts: 13
Joined: Wed Aug 28, 2019 8:53 pm

Re: Theremin project problem

Mon Sep 09, 2019 8:25 pm

Ok, we have python measuring the distance and converting it to a pitch value. Sonic pi doesnt seem to be able to find the value. How can I check that the messenger is working properly?

Return to “Beginners”