Recommended Posts

Really nice indeed! Now we can finally integrate a Pi into LEGO builds without being accused of 'impurities' ;)

Share this post


Link to post
Share on other sites
1 hour ago, JopieK said:

Really nice indeed! Now we can finally integrate a Pi into LEGO builds without being accused of 'impurities' ;)

Yeap - totally. This is going to be the route. Talk about illegal connections ;))

To Pi or not to Pi ... I am all into ESP32's. When a Pi is not only 3.14 something, then an ESP32 is maybe more than 2.71 or something. So let's get rolling ;)

All the best,
Thorsten

 

Share this post


Link to post
Share on other sites

That is a great concept, that brings much needed computing power to Spike robots.

I wonder if it is possible to attach multiple HATs to allow connection of more than 4 sensor / motors.

 

Share this post


Link to post
Share on other sites
2 hours ago, Munchkin255 said:

I wonder if it is possible to attach multiple HATs to allow connection of more than 4 sensor / motors.

The concept is just to mount the HAT onto the RaspPi. It is not possible to mount further HATs in that way.

But you could multiplex the UART, which means soldering, additional HW and so on.
And I suppose the SW-Libraries would not support this?

Edited by Lok24

Share this post


Link to post
Share on other sites

So I googled a bit - please educate me.

The "hat" is a PCB featuring 4 PUp terminals, a "7.2 to 8.5 V" socket (please tell me they are not doing this stupid thing again - this works with 9V, I bet my megablocks off - and if not: Out with it! Does anyone have a 7.2 to 8.5V power supply at hand???) - plus some magic electronics, which decides on in/output as used in the hubs and then the Pi's GPIOs are configured appropriately? 

Or does the Pi all decide on in/output, because it runs a program that tries to figure that out? As the LEGO hubs can do as well? So the hat is dumb and features a few H-bridges?

Very interesting!

Best
Thorsten

 

EDIT: A few months in the lab can easily save a couple of hours in the library, I know ;) Did some more reading:

"Powers your Raspberry Pi computer (except Raspberry Pi 400) and connected LEGO Technic devices when used with an external 8V ±10% DC power source, such as the Raspberry Pi Build HAT Power Supply, or a 7.5V battery pack". +/-10% - wow. I'd use a voltage regulator ...

"Onboard Raspberry Pi RP2040 microcontroller manages low-level control of LEGO Technic devices". So this is a Pi on a Pi, right?

 

Edited by Toastie

Share this post


Link to post
Share on other sites

There doesn't seem to be any clear detailed picture of the underside of the HAT.   Knowing what chips used could help figuring out if you can run 9V through it without letting out the magic smoke.  :pir-classic:

The HAT is like the motor driver board with an STM32 microcontroller for the ESP8266 Wemos. Using a microcontroller means the firmware can be updated.

Share this post


Link to post
Share on other sites
13 hours ago, Toastie said:

Or does the Pi all decide on in/output, because it runs a program that tries to figure that out? As the LEGO hubs can do as well? So the hat is dumb and features a few H-bridges?

I'm not sure about detection, but is this really important?

You have to code , as usual, "myMotor = Motor('A')" and connect the motor to A, in the program you use "myMotor"

And it's not a dump H-Bridge, cause you can read the motor data in the program, like other sensor data.

And somewhere the ID's whre mentioned, if you can read them you can figure out what is connected.

But documentation says:

Gets list of devices connected to the hat

class buildhat.Hat¶

Allows enumeration of devices which are connected to the hat

get()¶

Gets devices which are connected or disconnected

Returns

Dictionary of devices

Return type

dict

 

Edited by Lok24

Share this post


Link to post
Share on other sites
10 hours ago, Lok24 said:

I'm not sure about detection, but is this really important?

Of course, it is!

Man, when we get to this level of electronics (they may not target this, but - you know - they pave the road), then it is better to know what is going on. We are talking completely open access here. Sure, we can use libraries, suggestions, trainings, whatever - but hey: This is rock'n'roll.

It is absolutely important when wanting to go nuts. As of now, we used hubs, some tried ESP32's (including me) - but this was wireless and software. We are now talking wires, GPIOs, hardware. Next level would be prototyping breadboards - like this one: https://www.makershop.de/wp-content/uploads/2016/02/arduino-uno-prototype-shield.jpg

"They"'ll never do that, but folks will do that. Which is really cool.

All the best,
Thorsten

Share this post


Link to post
Share on other sites

Very interesting development!  It's always great to see official LEGO outreach and partnership with standards bearers like the Pi.  Personally I'd also like to see a partnership with Arduino as well, as I never got into Linux or the Pi but have put more than 10 years into the Arduino ecosystem.  And getting a little too old now to try new things. :pir-bawling:  It's quite an exciting time when the ecosystem of motors, sensors, and other pieces that use the LPF2 connector merge with the power and reach of the Pi ecosystem.

Most interesting to me from the news release is that this new HAT has a RP2040 chip on the bottom side-- this is the same chip that works as the main processor on the new, smaller Pi boards like the Feather RP2040 from Adafruit that are more Arduino- or Micro:bit like.  Does that mean it can also be programmed directly and work via MicroPython or CircuitPython, without needing a Pi at all?  Now that would be cool.  According to the Adafruit page, the RP2040 chip is quite a little powerhouse:

Quote
  • Dual ARM Cortex-M0+ @ 133MHz
  • 264kB on-chip SRAM in six independent banks
  • Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus
  • DMA controller
  • Fully-connected AHB crossbar
  • Interpolator and integer divider peripherals
  • On-chip programmable LDO to generate core voltage
  • 2 on-chip PLLs to generate USB and core clocks
  • 30 GPIO pins, 4 of which can be used as analog inputs
  • Peripherals
    • 2 UARTs
    • 2 SPI controllers
    • 2 I2C controllers
    • 16 PWM channels
    • USB 1.1 controller and PHY, with host and device support
    • 8 PIO state machines

That's a lot of power, and a lot more than just a motor driver.

Will be interesting to see what projects come out of this!

Share this post


Link to post
Share on other sites

Pretty sure the RP2040 can be reprogrammed with the right software programmer and knowing which pins to jumper.  :pir-classic:

1 hour ago, Toastie said:

Of course, it is!

Man, when we get to this level of electronics (they may not target this, but - you know - they pave the road), then it is better to know what is going on. We are talking completely open access here. Sure, we can use libraries, suggestions, trainings, whatever - but hey: This is rock'n'roll.

It is absolutely important when wanting to go nuts. As of now, we used hubs, some tried ESP32's (including me) - but this was wireless and software. We are now talking wires, GPIOs, hardware. Next level would be prototyping breadboards - like this one: https://www.makershop.de/wp-content/uploads/2016/02/arduino-uno-prototype-shield.jpg

"They"'ll never do that, but folks will do that. Which is really cool.

All the best,
Thorsten

I have one those shields.  I used for a bluetooth to Power Function IR controller (https://www.brickshelf.com/gallery/drspock/arduino/prototype-shield.jpg)  

 

The Pi is more powerful than ESP32. You could run a webserver for guests at your LUG events to connect with their own phones through wifi and play with your Powered UP display.  You can connect a bunch of Pies with HAT on a IP network and Node-Red.   It's COVID safer and you don't risk your smart device or PU remotes getting lost/stolen.

Share this post


Link to post
Share on other sites

32 bit microcontrollers are certainly very interesting, but to activate motors the speed of execution is not that important and with a simple 8 bit such as the Arduino Nano and a Shield of connections.

I think I have shown that without soldering and without any knowledge in electronics, we can achieve quite interesting things, even ambitious.

Share this post


Link to post
Share on other sites
11 hours ago, Toastie said:

Man, when we get to this level of electronics (they may not target this, but - you know - they pave the road), then it is better to know what is going on. We are talking completely open access here. Sure, we can use libraries, suggestions, trainings, whatever - but hey: This is rock'n'roll.

It is absolutely important when wanting to go nuts. As of now, we used hubs, some tried ESP32's (including me) - but this was wireless and software. We are now talking wires, GPIOs, hardware. Next level would be prototyping breadboards - like this one: https://www.makershop.de/wp-content/uploads/2016/02/arduino-uno-prototype-shield.jpg

"They"'ll never do that, but folks will do that. Which is really cool.

 

I really don't know want you want to explain or know or say?

The question was about "auto detection", and this has nothing to do with any "wires, GPIOs, hardware"
It's just a matter of software and LEGO-Komponents and protocol. And I described how to handle. It's the same for any ESP, Arduino, Pi, pybricks and so on.
They all use WLP 3.0

And we are talking about the HAT, and when attached there are no "wires, GPIOs, hardware" anymore, just 4 plugs and Software.

 

9 hours ago, dr_spock said:

The Pi is more powerful than ESP32. You could run a webserver ....

Yes, which is possible on the ESP too, I use that to configure the M5Stack Atom for specific parameters (i.E: carousel, how long should it run at which speed, pendular train, how log wait and so on)
(the program it is fixed in teh ESP, but reads parameter-files, which are written when via web parameters are changed)

I showed that here for a wile.

The central advantage: developement is much faster, cause you develope and run on the same devivce..

Share this post


Link to post
Share on other sites
2 hours ago, Lok24 said:

I really don't know want you want to explain or know or say?

Oh, I didn't want to explain anything - I am excited about the fact, that a HAT of this sort, i.e. without any GPIOs, may very well expand into something (in the future, by some e-gurus that are certainly around here :pir-grin:) that features such pins/sockets/breadboard style layout as referenced in my post.

What I know? Hmm, I believe it is safe to assume this is next to nothing compared to what others know! I like to play with hardware a lot - on a >total< laymen level. Since about 45 years. But nothing professional ever.

What did I say? I guess I tried to voice excitement about a HAT that some may come up in the future that feature the PUp sockets along with the BLE features and some breadboard style area where I can plug in resistors, diodes, you know, the works :pir-stareyes:

I guess that was all.

Best
Thorsten

Share this post


Link to post
Share on other sites
1 hour ago, Toastie said:

I am excited about the fact, that a HAT of this sort, i.e. without any GPIOs, may very well expand into something (in the future, by some e-gurus that are certainly around here :pir-grin:)

 

This is easily possible today and well described in the documentation of the LEGO HAT.
And then you can add your breadboard and resitors or whatever you want. Today. There are pictures, that's where I know from :wink:

And of course it uses GPIOs, the simplest way. They are documented.

I thougth your original question was about the "auto detection" of the ports (!= GPIOs, they are fixed), and all my responses concernd to that question.
And I still think: yes, you can check if a motor is attached, and yes, you can get a dict of the ports.

Some nice kind of missunderstanding?

Edited by Lok24

Share this post


Link to post
Share on other sites
3 hours ago, Lok24 said:

Some nice kind of missunderstanding?

:pir-thumb: Yes Sir!

Thanks for clarifying!

Best
Thorsten

Share this post


Link to post
Share on other sites
17 hours ago, dr_spock said:

The Pi is more powerful than ESP32.

Well the Pi varieties are classified as micro-computers, aren't they? Whereas the ESP32 is still a micro-controller, right?

The (now already old) ESP32 wroom "chip/module" is not necessarily what I would call a lame duck (https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf) ... at least as far as I am concerned:

  • ESP32-WROOM-32 contains two low-power Xtensa® 32-bit LX6 microprocessors
  • 448 KBytes ROM for booting and core functions
  • 520 KBytes on-chip SRAM
  • 8 KBytes SRAM in RTC SLOW
  • 8 KBytes SRAM in RTC FAST
  • 1 Kbit of EFUSE, 256 bits MAC
  • WiFi: 802.11 b/g/n/d/e/i/k/r (802.11n up to 150 Mbps)
  • Bluetooth v4.2 BR/EDR and BLE specification
  • Wi-Fi mode Station/softAP/SoftAP+station/P2P
  • Security WPA/WPA2/WPA2-Enterprise/WPS
  • Encryption AES/RSA/ECC/SHA
  • IPv4, IPv6, SSL, TCP/UDP/HTTP/FTP/MQTT
  • Interfaces: SD-card, UART, SPI, SDIO, I2C, LED PWM, Motor  PWM, I2S , IR, GPIO, capacitive touch sensor, ADC, DAC, Hall sensor, temperature sensor
  • Operating temperature -40 + 85C
  • Operating voltate: 2.2-3.6V
  • Consumption: 80 mA typ
  • Dimensions: 18 mm x 20 mm x 3 mm

It sure can run a web server ... but I certainly wouldn't know how to do that.

In my super simple applications it uses about 0.1% of its capabilities - so I am somewhat in line with what @oracid said:

10 hours ago, oracid said:

32 bit microcontrollers are certainly very interesting, but to activate motors the speed of execution is not that important and with a simple 8 bit such as the Arduino Nano and a Shield of connections.

I think I have shown that without soldering and without any knowledge in electronics, we can achieve quite interesting things, even ambitious. 

However, @Cornelius made his Legoino (BLE) code for ESP32's - no idea what other platforms are compatible with that library.

Not important: An ESP32 Dev board is tiny and cheap, my favorite way of life :pir-laugh: 

All the best,

Thorsten

Share this post


Link to post
Share on other sites
32 minutes ago, Toastie said:

Well the Pi varieties are classified as micro-computers, aren't they? Whereas the ESP32 is still a micro-controller, right?

You are right ! But the RP2040 is a RaspBerry PI, but not a PC.

Here, the Arduino Nano RP2040, https://store.arduino.cc/products/arduino-nano-rp2040-connect?_gl=1*y305oh*_ga*MzYyMTI3NDg0LjE2MzQ0NjA5MTk.*_ga_NEXN8H46L5*MTYzNTAwODM0Mi4zLjEuMTYzNTAwODQxNi4w

Edited by oracid

Share this post


Link to post
Share on other sites
27 minutes ago, Toastie said:

It sure can run a web server ... but I certainly wouldn't know how to do that.

Very simple:

#include <WiFi.h>

WiFiServer server(80);
WiFiClient client;

void startServer()
{
WiFi.softAP(ssid, password);
server.begin();
}

 

Share this post


Link to post
Share on other sites
2 hours ago, Lok24 said:

Very simple:

Oh, yes it is ...

... time goes by (but not so slowly as Madonna claims in her song "hung up") ... one thing after the other though - need to get a 1.5" OLED display up and running on the I2C bus. Waveshare made life easy and pre-selected SPI as default mode. It is very simple to change to I2C mode: Just move the default resistors connecting to GND over to VCC - pads are ready to go. There is only one tiny little problem: The resistors and pads are size 0805. My soldering iron looks like one better suited for sheet metal roofing (under the magnifying glass) ...     

Thanks again Werner!

Best
Thorsten

Share this post


Link to post
Share on other sites
On 10/22/2021 at 10:47 PM, Toastie said:

Man, when we get to this level of electronics (they may not target this, but - you know - they pave the road), then it is better to know what is going on. We are talking completely open access here. Sure, we can use libraries, suggestions, trainings, whatever - but hey: This is rock'n'roll.

Don't forget the breakout pins in the ultrasonic sensor. We have access to the electronics since SPIKE Prime was released.

Share this post


Link to post
Share on other sites
On 10/21/2021 at 12:19 PM, Lok24 said:

It is not possible to mount further HATs in that way.

It might(?) even be possible to stack 5 of them
Wich is 20 switch points
Wich means you can claim the entire attic for your trains :head_back:

I have at this moment no idea if/how the LEGO hat has an ID pin and can be stacked but I suppose that it will be possible since the Pi has very few limits.
Waiting for my hat now.

https://www.sossolutions.nl/pimoroni-phat-stack-fully-assembled-kit
 

Edited by JaBaCaDaBra

Share this post


Link to post
Share on other sites
12 hours ago, JaBaCaDaBra said:

It
I have at this moment no idea if/how the LEGO hat has an ID pin and can be stacked but I suppose that it will be possible since the Pi has very few limits.
 

You shold  have a look at the used GPIOS and how the software handels them.

I did not find any idea in the SW how to adress.

Share this post


Link to post
Share on other sites
1 hour ago, Lok24 said:

You shold  have a look at the used GPIOS and how the software handels them.

I did not find any idea in the SW how to adress.

I hope to receive my hat this week and will try to figure out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.