Connections to Raspberry Pi?

Raspberry Pi just released the Pico W with wireless capability for $6:

The post by @cymplecy regarding Snap! + Raspberry Pi in August 2020 looked very promising:

This Jan 21 post also seems as though it may have potential:

Would it be possible to get an update on the potential capability of Snap! to communicate with a Raspberry Pi and control it? (Thanks!)

Do you mean talking to a full Pi or the new Pico Pi?

Microblocks is much better suited for using on microcontrollers such as the Pico

Students in our maker workshops design and build a motor:

     https://github.com/maketolearn/Invention-Kits/tree/main/Linear%20Motor%20Kit

We would like for them to be able to integrate the art & music projects that they have created in Snap! with extensions that will enable them to incorporate kinetic art / motion.

Therefore, an extension that could control an external motor from Snap! would be better. The precise model of the microcontroller is not important as long as it is (a) affordable and (b) can be controlled by a PC or Chromebook.

The "Serial ports" library allows you to connect Snap! to a device controller that runs a local web server on your machine.

Also, I understand that the Pi software includes a version of Snap!. But I don't have one myself so I don't know the details.

OK

The cheapest method is to use a microcontroller board with an additional motor driver (as microcontroller cannot supply the current motors require)

One method would be an Arduino board with a plug in added controller - cost varies considerably up to $40 depending on where you source the components

Another method would be to use a WEMOS D1 mini with a motor shield - this could cost as little as $10 but would require a bit of soldering.

It could be controlled over USB but also it could be controlled via WiFi.

You/we would have to develop software to run on these controllers to accept commands from Snap! but once that is developed, then it would just need uploading to each controller once

And just to add, if your computers are "locked down" by an IT department, then it can prove very difficult to get physical computing projects such as this to work.

You either need total software deployment control or a VERY helpful IT department :slight_smile:

I had the advantage of being the Network Manager in my schools :slight_smile:

Since Snap! is a browser app - it runs the same on a Pi as a PC/Mac - just a bit slower

My Mayflower project running on a Pi4

It does?

We collaborated with Roger Wagner to develop a shield for the Arduino, now in its fourth iteration, that includes a motor controller.

Arduino Shield

This works well, and we have been using it with Snap4Arduino for several years. However, the combination of the Arduino plus the shield & motor controller costs about $25. So, in cases in which we would like each student in a class of 20 students to take away a working motor & controller, the cost is about $500 per class.

We haven't worked with the Raspberry Pi, but the low cost ($4) seems attractive if we had a way to communicate with it from a PC using Snap! (We could probably add an amplifier to the output to obtain enough current to drive a motor.)

If we attempted to run Snap! on a Raspberry Pi, we would need to acquire monitors, keyboards, etc., to obtain complete working systems usable as stand-alone computers. Since the students already have PCs and Chromebooks, this would quickly drive up the cost. It seems as though it would be more economical to connect a Raspberry Pico to a PC and use it as a microcontroller. Is there something that we're missing or not understanding about the economics?

No, they have a "headless" Snap! that you program using your big computer, then export the result to the Pi as an xml that can then run independently. I think. Not sure I've ever actually seen a Pi.

When we have some time later this summer, we may acquire a Raspberry Pico to gain some firsthand experience and get a better idea of its potential. The price and size are certainly attractive. Thanks for the suggestions.

The WEMOS D1 mini with motor shield is a long established product combination and IMO would be the most cost effective solution for your requirements.

I've never heard of anything like that!

I think you've had a dream sometime :slight_smile:

regards
Simon

With current pricing at about $3.75 per unit, the WEMOS D1 certainly seems affordable. Can you point us to any information about controlling it with Snap! ? (Thanks!)

I am collecting a motor shield tomorrow to test out for you :slight_smile:

Great ... we'll look forward to your results ... and thanks.

"Serial port" library allows direct access to any USB/CDC (serial port emulation) device. So you can "talk" to a program running on the microcontroller board.

With micropython@Pico in REPL mode, everything you send to the board is interpreted as a program.
There is a typical led switching program (not tested yet as my pico is buried somewhere)
untitled script pic - 2022-07-01T215249.499

There are cheap lightweight servos known as the SG90/MG90, easily modifiable to continuous rotation and driven directly by single I/O line.
Those are available through global retailers or EB for less than 2$ each.

We haven't used the Serial Port library, but the ability to send a command from Snap! that is interpreted by the remote machine is exactly what we need. Thanks for providing a starting place.

Well, I could be wrong -- it happens once a decade or so. :~P

Do you think of the Snap4Arduino Autonomy via CLI ?
I'm not sure if it's still active @bromagosa .