Getting Started Problems


#1

Hi - sorry to begin my postings with the Forum with something so basic. I recently got my brickpi started kit, assembled the case and configured my Pi. I have no difficulty connecting to the Pi from my Mac using VNC and am able to see the Pi desktop, browse around, edit, save and run basic Python programs etc.

I also put together the SimpleBot with no problems. But I cannot get it to move.

I’ve tried running the simplebot python programme. I’ve also tried running the basic Scratch script. The scratch script seems to be responding but no motors are moving. As far as I can tell the motors are connected to the correct sockets (A and D, right?) for the Scratch Motor Test demo. But nothing happens.

Any ideas? By the way, the tutorial found at
http://www.dexterindustries.com/BrickPi/program-it/scratch/

seems a little out of date: on my BrickPi, the Cat icon is just called Scratch, not “BrickPi_Scratch_Start”, and when I launch it, Scratch opens, but not any terminal window (unless this is connected to my problems?).

Grateful for your advice.

S


#2

Hey SJ67! No worries with this at all, thanks for contacting us about the problem. It sounds like you have everything setup correctly. Mind if I pepper you with a few of our questions? :slight_smile:

  • How are you powering the BrickPi?
  • Have you tried running any of the sensor programs? Like the touch or ultrasonic sensor? It would be especially helpful if you could try with the python examples.
  • Have you tried running the python example for motors? Was this successful?

Thanks SJ67. Again, sorry for the troubles. We can work through this though!


#3

Hi there - and thanks for the reply.

Powering using the battery pack provided with the kit, with eight AAs (rechargeables) in there, so should be powerful enough. Certainly the power lights on the board are showing and, as mentioned, the Pi is working fine in a general sense.

Just ran the Python sensor tester programme for the Ultrasound sensor and it worked, so that’s very promising.

But I can’t get simplbot.simple_py to work. Could it be something to do with the fact that I’m running ‘through’ VNC from my Mac and so it’s not picking up my key strokes properly?


#4

Further on that: I tried editing Simplbot.py down to something that just ran the motors straight away, without waiting for any key stroke. Nothing happened…

I’ll admit that I’m a bit confused as to which ports are which for the motors in question. The code seems to mix things up a bit. This little excerpt of the code illustrates:

def stop():
BrickPi.MotorSpeed[motor1] = 0
BrickPi.MotorSpeed[motor2] = 0

BrickPiSetup() # setup the serial port for communication

motor1=PORT_B
motor2=PORT_C
BrickPi.MotorEnable[motor1] = 1 #Enable the Motor A
BrickPi.MotorEnable[motor2] = 1 #Enable the Motor B

Sometimes the motor is referred to as ‘motor1’, sometimes as on Port_C, sometimes as Motor B (admittedly in the comments). Maybe you can confirm for me which physical ports they need to be connected to?


#5

Great news that the sensor worked! I will take one more look at the simple bot code, maybe something was damaged in it. I see your point about it being confusing though. I’ll try to make that less so.

Let’s make sure the motor chips work though. Can you try this:

cd ~/Desktop/BrickPi_Python/Sensor_Examples/
sudo python LEGO-Motor_Test.py

Do this with the motors plugged in. It should tell any of the four motors to move. Do the motors move?


#6

Hi - the good news is that the Motor-Test worked. Thx! Brickpi goes forward and reverses just fine.

But when I run the more complicated SimpleBot_Simple from the projects folder using sudo python, the keyboards commands don’t work to control the pi and so the robot just sits there.

My theory is that somehow this is connected to my trying to do this over VNC from my mac. I’m going to attach a screengrab of what the terminal (viewed through VNC) is doing. Perhaps it is that my keystrokes aren’t ‘coming through’ to the Pi?


#7

That’s fantastic news. So the hardware is good, excellent to know.

It looks like you’re using the arrow keys to try to move the example (I see a bunch of brackets like [[ ) in your screenshot. HOwever, if you look at the code on simplebot_simple.py, line 18 - 23, you’re supposed to use the keystrokes w, a, d, s and x to move motors.

Did I miss something, were you using the correct keys?


#8

I have the same problem. LEGO-Motor_Test.py works fine. But the simple_bot doesn’t respond to inputs of w, s, a, d, or x. What could be wrong?


#9

I use VNC from my Windows desktop just fine.
Just tried running simplebot_simple.py from VNC & the program & keystrokes worked fine.
I am using my modified firmware & BrickPi.py code on a RPi 3, though I don’t think that would matter.


#10

haha… I just missed that I had to send the command by hitting Enter. It works perfectly now.
Christmas is saved.


#11

This topic was automatically closed after 12 hours. New replies are no longer allowed.