Wifi and Downloadable Code

Hi, I have three inquiries:

  1. My BrickPi robot can’t connect to wifi. The robot works when connected to ethernet. I can’t find corresponding networks between the robot and the laptop. I have used these instructions http://www.dexterindustries.com/BrickPi/getting-started/using-the-pi/setting-wifi/ to no avail. I am connected to “Secure” but when I scan for networks for the BrickPi, multiple options for “Secure” pop up, and none of them work.

  2. Is there any way to upload code from the offline editor to the online editor/dexter industries desktop?

  3. Can I download code onto the Pi (the way we can with the LEGO Mindstorm brain), so it can run a program without being connected to wifi?

Thanks!

Hello,
Is “secure” the name of your wifi network? And do you use Raspbian for Robots, if so, which version of it? (You can look in the Version file on the desktop to know if it’s Wheezy or Jessie). The wifi connection setup differ slightly between the two versions.

Could you try the following, just to verify if the Pi is ready for wifi.
While connected via Ethernet, can you start a terminal and run
ifconfig
It should give you a bunch of text back, in two or three paragraphs. One will be called eth0 - that’s your ethernet connection. It will give you an IP address in that paragraph, most likely starting with 169.
Another paragraph will be entitled wlan0 - that would be your wifi dongle. If you don’t see the wlan0, then the problem is the Pi doesn’t recognize your wifi dongle.
If you do get a wlan0, check for an IP address in that paragraph. If you have one, then you are indeed connected via wifi.

2). you can transfer files from your desktop to your Pi. The how would depend if you’re running a Windows machine, a Mac or a Linux.

  1. You can indeed start programs at boot on the Pi, if they’re python programs (and other languages, but not Scratch). It’s not a simple question of drag and drop, but it’s not terribly difficult, depending on your technical level. Here’s one option
    http://www.dexterindustries.com/howto/auto-run-python-programs-on-the-raspberry-pi/
    and here’s another approach (just change the filename and file path to suit your needs)
    http://www.dexterindustries.com/projects/rain-notifier/ (see step 6 near the end)
  1. Yes and Yes. Wheezy.

  2. Windows

  3. Darn! I’m using Scratch because I’ll be teaching kids how to use the robots next summer.

  4. Also, I want to use EV3 sensors. I found this page http://www.dexterindustries.com/ev3-sensors-brickpi/ and I am wondering which of the two methods you recommend using (Arduino or AVR). But, as I mentioned, I’m a little confused because the google doc instructions for each method are in Python, and I only know how to use Scratch.

Your EV3 sensors will work with your Wheezy card, so don’t worry about the firmware flashing. It’s already done for you on that card.

But let’s work on getting you working on Wifi. Did you run the ifconfig command in a terminal window?

I don’t know what the ifconfig command is… so no! What is that?

Update: I took the robot home, so there aren’t multiple options for the same wifi name (there were multiple because I was at school). It says the wifi is connected, but when I take out the ethernet cable, the Raspberry Pi desktop shuts down.

Okay another update: Instead of plugging the robot into my laptop, I plugged it into my tv with an HDMI cable; I was able to connect to the wifi and get the robot to move completely wirelessly. So now I am trying to treat my laptop as a dumb terminal like the tv, but when I plug an HDMI cable into my laptop, the laptop doesn’t recognize any input. So the question is: what changes between just using the robot with a monitor/keyboard/mouse versus using the robot with a laptop/ethernet cable?

Woohoo! Nice work! So you got it working at home, completely wireless, by remote-connecting to it through your laptop once the wifi was set up, is that right? If so, that’s great news, as it means there are no issues with the robot.

Now I’m going to guess that your “Secure” network is a school wifi network, or some sort of public place network? (library, university, …) Those wifi networks pose special challenges, and there’s an alternative, much simpler approach.

Have you heard of Cinch? It’s a Raspbian for Robots with a special way of handling the robot/laptop connection that does not depend on the local wifi.
You can read more about it here:
http://www.dexterindustries.com/raspbian-for-robots/#cinch

With Cinch, it’s the robot that becomes your wifi. Each robot emits its own wifi network, and each laptop connects directly to the robot. This works great even in areas with no central wifi.
The downside is that, once connected to the robot, your laptop is no longer accessing the internet. That’s great in camps and classes as kids have one less temptation, but it makes updating the SD cards a tad harder.

If this solution interests you, let me know, I’ll help you set it up.

Cleo

No. The robot worked wirelessly when it was only connected to a monitor, keyboard, and mouse. It doesn’t work when using a laptop.

We are working at a university, and I am interested in using Cinch!

UPDATE: We are wireless! The robot was connected to wifi and ethernet at the same time, but the problem was the robot was still running on the ethernet IP address. So I typed the wifi IP address into another tab on my internet browser, and I was able to get into the VNC page again but on the wifi IP address!

Now we need to figure out the EV3 sensors.

great to hear that the wireless setup is working for you. Can you try out the EV3 sensors examples from here: https://github.com/DexterInd/BrickPi_Python/tree/master/Sensor_Examples.

-Karan

I am using Scratch, not Python.

Yeah! And yes indeed, if you have both Ethernet and Wifi going on, then dex.local will have to pick one. And then, if you disconnect the Ethernet, but do not refresh the webpage, the browser will still look for the Ethernet IP. The Pi isn’t crashing, it’s just disconnected.
Sometimes the browser insists on going to the ethernet address (“But it worked last time!” syndrome). And you need to clear the browser cache.

I really need help getting these EV3 sensors to work.

Just a reminder, I am using the BrickPi with Scratch.

When I use the touch sensor with the Dexter example code, the cat sprite says I’ve pressed the button before I even start and continues to count even when nothing has been pressed.

When I use the ultrasonic sensor, the cat sprite only reads “-1” no matter what. Also, are the little red rings around the ultrasonic “eyes” supposed to be lit? Sometime they flash for just a second.

Also, my color sensor does not make any readings.

I’ve also been using the “Ultrasonic Motor Example” code with NXT sensors, and while the NXT sensors at least respond, sometimes the reading doesn’t make any sense. It never goes to zero, so the wheels never stop.

The NXT touch sensor works fine with our robot and the Dexter example code.

Is it possible that the DI example code I’m using is for NXT sensors?

OKAY UPDATE TIME!

We can use the EV3 sensors. In the example code, the block which broadcasts and joins the port to the sensor reads “COLOR,” “TOUCH,” or “ULTRASONIC.” BUT they should say “EV3COLOR,” “EV3TOUCH,” “EV3US,” etc.

Nice find. I’m new to BrickPi myself. (Well I was a kickstarter backer, but ended up not using it when I first got it). And I just got my EV3 sensors, so I’m not familiar with BrickPi/EV3/Scratch combo.
I’ll make good note of the broadcast commands, thanks!

Hi aewang, just to confirm you’re using the BrickPi+, is that correct? And it all worked out, you’re able to read the EV3 sensors?

@CleoQc, if you were a Kickstarter backer back in 2013, the board you were shipped won’t support EV3 sensors. You will either need to manually update the firmware (very tough) or upgrade to a BrickPi+, to be able to use EV3 sensors with your BrickPi.

@John

Yes, we are using the BrickPi+. The EV3 motors are working and the EV3 sensors are working… kind of. The touch sensors work. The ultrasonic sensor and the color sensor turn on, but the readings don’t make sense. For the U.S. sensor, the cat will report readings from 100 to 65535, and for color, the cat will change colors even when the sensor hasn’t moved and vice versa.

I suspect we have a fundamental misunderstanding of how the code works. For instance, when you use the LEGO brick and the LEGO code, you can choose what mode you want your sensor to be on, what units to use if measuring distance, etc. But we have no idea how to do that in Scratch. Specifically, with the U.S. sensor, the readings of 100-65535 are probably raw data (Do you agree that these numbers are probably raw data?), but we don’t know how to convert it to distance. And for the color sensor, we don’t know how to access the Reflected Light Intensity Mode (to follow a black line) instead of just the Color Mode.

In Scratch, we have to say BROADCAST(SETUP). A colleague of mine thinks if we know what exactly we were telling the robot to do when we use the command SETUP, then maybe we could fix the issue, but I can’t find any way to view/change the SETUP command. Do you think our issue lies in the configuration of these settings, and if so, how do we edit SETUP?

Also, like the U.S. sensor, the gyro sensor gives wild readings, so again, I suspect it’s raw data that hasn’t been converted properly.

BTW I know the sensors themselves are fine because I was able to use them with the LEGO brick.

Thanks for you help; I look forward to reading your response!