Motion sensor not showing in Scratch[SOLVED]


#1

We’re trying to do Mission 8 and we can’t get Scratch to show ‘motion’ in the sensor value. We’ve updated the GoBox and we haven’t had any trouble attaching sensors in past missions. But, now, no matter how many times we’ve rebooted, turned off and rechecked the connections, turned back on, etc - we can’t get ‘motion’ to show up in the sensor value dropdown.

Any ideas?

I did run the troubleshooter and here’s what it gave me:

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 2.7G 4.2G 39% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 6.1M 425M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 21M 40M 35% /boot
tmpfs 87M 4.0K 87M 1% /run/user/1000
a
Check for dependencies

python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u2 install ok installed
libi2c-dev 3.1.1+svn-2 install ok installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.2~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
arduino 2:1.6.0 install ok installed
minicom 2.7-1 install ok installed
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.32
Copyright © 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest

  • Device tree is enabled.
  • This Raspberry Pi supports user-level GPIO access.
    -> See the man-page for more details
    -> ie. export WIRINGPI_GPIOMEM=1

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 3: Dev 4, If 0, Class=Vendor Specific Class, Driver=rtl8192cu, 480M

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0' or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – -- – -- – 08 – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version and CPU Speed and Voltage

v 1.6
CPU speed: 2
10.99 V

CHECKING ENCODER READINGS
0 0
Both motors moving Forward with LED On
after 5 sec 186 182
Both motors stopped with LED Off
None after stop cmd 194 188
None after 2 more sec 196 189
Both motors moving back with LED On
after 5 sec 384 378
Both motors stopped with LED Off
None after stop cmd 392 384
None after 2 more sec 394 385

CHECKING ENCODER TARGETING

Initial encoder read vals: 0 2
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 0
Final encoder read vals: 74 74

Initial encoder read vals: 0 2
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 0
Final encoder read vals: 74 74

Initial encoder read vals: 0 2
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 0
Final encoder read vals: 77 74

Initial encoder read vals: 0 2
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 0
Final encoder read vals: 76 74

Initial encoder read vals: 0 2
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 1
Enc tgt Status: 0
Final encoder read vals: 75 74


#2

One more thing to add… I did just test to see if the D11 port was the issue by setting the GoPiGo up with the Mission 7 connections (light sensor A1 and LED D11) and ran the Scratch program and everything still worked fine.

I also tried using a different cable to connect the motion sensor but still nothing.

Could it be a bad sensor??


#3

No response to this yet, so I took a look at this forum thread and thought it might pertain to my problem.

http://forum.dexterindustries.com/t/scratch-and-troubleshooting-crash-after-sw-update/1993

Well, after following the terminal instructions in the thread, I now have the exact problem as the guy in the thread. Namely, I can’t even open Scratch now! Ah!! When I click the Scratch icon, the terminal window opens and then immediately closes.

Also, cd Desktop/GoBox/Scratch_GUI says there is so such folder as ‘Scratch_GUI’ and it does appear to be gone.

What have I done? And, more importantly, how do I fix it?

HELP!!!


#4

The properties for the Scratch icon on the Desktop seem to point to a Scratch_GUI folder in Dexter/lib/Dexter/ instead of Desktop/GoBox/ so I tried ‘cd Dexter/lib/Dexter/Scratch_GUI’ followed by ‘python Scratch_Start.py’ and got the following errors:

access control disabled, clients can connect from any host
pi@dex:~ $ cd Dexter/lib/Dexter
pi@dex:~/Dexter/lib/Dexter $ ls
auto_detect_robot.py  Scratch_GUI  script_tools  Troubleshooting_GUI
pi@dex:~/Dexter/lib/Dexter $ cd Scratch_GUI
pi@dex:~/Dexter/lib/Dexter/Scratch_GUI $ python Scratch_Start.py
Traceback (most recent call last):
  File "Scratch_Start.py", line 503, in <module>
    write_state(autodetect())
  File "build/bdist.linux-armv7l/egg/auto_detect_robot.py", line 170, in autodetect
  File "build/bdist.linux-armv7l/egg/auto_detect_robot.py", line 121, in find_brickpi3
UnboundLocalError: local variable 'brickpi3' referenced before assignment
pi@dex:~/Dexter/lib/Dexter/Scratch_GUI $ 

Not sure what any of this means, but I hope someone out there will. Thank you in advance for any help you can offer.


#5

I’m taking a look right now. First goal is to get Scratch back up. I’ll be right back with more info

Not your fault and I’m sorry we gave you a scare! We did a re-organisation on the SD card. You will find it in ~/Dexter/lib/Dexter/Scratch_GUI

Could you run the auto_detect_robot.py program that is in the same folder? It should either report a GoPiGo or give you the same error as when you try to start Scratch manually.

Also could you check if you have the files for BrickPi3 on your SD card? They will be in ~/Dexter/BrickPi3
If you don’t see them, could you attempt the DI Update again, please?

We’ll get back to the original problem as soon as we can get Scratch back up and running. Truly sorry for this hurdle. I have not encountered this particular situation yet but I’m confident we can solve it.

Cleo


#6

I’ll take a look when I get home from work this evening and report my findings back to you.

Thank you for the help!


#7

Here’s the error I get from running auto_detect_robot.py:

pi@dex:~/Dexter/lib/Dexter $ python auto_detect_robot.py
Traceback (most recent call last):
  File "auto_detect_robot.py", line 205, in <module>
    detected_robot = autodetect()
  File "auto_detect_robot.py", line 170, in autodetect
    if find_brickpi3():
  File "auto_detect_robot.py", line 121, in find_brickpi3
    except brickpi3.FirmwareVersionError:
UnboundLocalError: local variable 'brickpi3' referenced before assignment

And, I do appear to have the files for BrickPi3

pi@dex:~/Dexter/BrickPi3 $ ls
Firmware  Hardware  Install  LICENSE.md  README.md  Software  Troubleshooting

#8

So – what do I do now??? We’d love to be back up and running this weekend, if possible.


#9

Can you run another update? We fixed something in the auto detect library which should bypass this issue at the very least. And my apologies for the delay in following up. I’m fighting a nasty cold. :frowning:


#10

Sure. We’ll do that this afternoon and report back.

Thank you and I hope you feel better.


#11

After DI update Scratch works again. Hurray! Thank you!

Now, I’m back to my original problem. Motion sensor still not showing. I’m just trying to a do a simple test of in a repeat loop block:

'Broadcast MOTION’
say ‘sensor value’ but my only choices are:

slider
light
sound
RESISTANCE-A
RESISTANCE-B
RESISTANCE-C
RESISTANCE-D

tilt
distance

What’s the next step?


#12

One thing I just noticed. When I open scratch and select “Start Programming”. It opens a new Scratch file BUT I’m not getting the pop up that says it’s loading in sensors (or whatever that used to say).


#13

Yeah! You’re back on your feet! Really sorry about the issue there… Now we can go forward.
First good news: that little popup window that no one was reading is gone on purpose. So that’s not an issue.

I know you’re doing Mission 8 so you’re familiar with this but I have to ask so I know everything is covered. Have you run the program once? Or at the very least click on the Broadcast Motion block at least once? The Motion option will only appear in the sensor block if the broadcast has been sent at least once. Can you confirm this is the case?

When you do a Broadcast Motion, what does the Scratch controller window says?
You can take a look at this video if you’re not sure what I mean by the Scratch Controller window.

Cleo


#14

Ah… we hadn’t run it because we couldn’t get the sensor value. In previous missions we never had to run it once to get the sensor value to show up. Unless we were accidentally running it and weren’t aware?

In any case, after running the broadcast motion once it now shows at the bottom of the list and everything is working as expected. Thank you!


#15

Yeah! I’m glad you’re up and running! And I do apologize first for the delay, and second for the hiccup with the update.

Hope you enjoy mission 8!


#16

This topic was automatically closed after 2 days. New replies are no longer allowed.