Major Alvega is a fictional hero from my childhood favorite comic magazine, “O Falcão”.
My real name is Jorge.
I am an Electrical Engineer by formation but systems administrator by chance.
Married, owl father of 2.
Recently returned from the LEGO’ Dark Night thanks to a LEGO Mindstorms EV3 set that my wife gave me us a birthdat present. Then discovered the Raspberry Pi, the Portuguese LEGO community, the ev3dev project, the LEGO MCP and not even God knows what more will come…
I don’t really have a focus in a particular area but I do like to demonstrate STEM concepts to my kids and I like to use to use LEGO as a framework or a tool for that purpose. So usually my “LEGO things” are more focused on showing some kind of functionality instead of looking nice. That also means that I fall to the Dark Side quite often, cutting some LEGO wires, soldering, gluing or painting something – hey, not my fault that LEGO doesn’t make LASER or UV bricks 🙂
Also quite often my small proof of concepts tend to grow too much and too fast. My first “Raspberry Pi and LEGO” project, an escalator, wasn’t tall enough for my older kid… trying to find more liftarms I soon found that there is a large online market of second hand LEGO… I was doomed!
When I started this blog, I often stated that I am not a programmer. I used some programming languages at university but I really never learned how to program so most of my coding is in fact a lucky mix of googling, copy&past and try&error iterations. Nevertheless, after some experiments with Bluetooth Low Energy protocol, I found myself doing something that might resemble real code thanks to the generosity of lots of people that opened their source to the world. Some even directly helped me!
So yes, I strongly support openness. Not just open source but open idea – science evolves “on the shoulders of giants” but also on the shoulders of lots of anonymous people who keep pushing it a bit further every day. That’s one of the reasons I like so much to use ev3dev with the LEGO MINDSTORMS EV3 – the possibilities are truly amazing.
Strong coffee, dark beer, apple-cinnamon, Xutos&Pontapés and Martini complete the whole pack.
You might also find me at:
-
- My Youtube channel
- My LUG forum (nickname: cyberx)
- My flickr albums
- My Tumblr photos
you habe a sbrick, right? Do you know when the sbrick is released, because I couldn’t find ans date in the offical SBrick website. Thanks for answering
I am beta testing a sbrick, yes (pledged for it at the kickstarter campaign). They keep saying first sbricks will roll out at the end of November for the kikstarter requests, then for the others. I believe they might have a 1-2 week delay, no more than that. But wait for wednesdat, they are announcing a status update (https://social.sbrick.com/forums/topic/20/chasing-an-order)
Hello Fellow Scratch/LEGO Hacker:
A project got started on the LEGO Education Community forums to create a set of “open” (OER) lessons that would teach Scratch Programming and LEGO WeDo Mechanics/Robotics together. If this project interests you, please take a look at the discussion so far at [https://community.education.lego.com/t5/WeDo/A-book-for-Middle-School-Age-Students/m-p/11741#U11741].
Hi,
I’m currently working on a project where I have the new lego train and I want it to be controlled from a raspberry pi. I’ve been looking through your posts and trying some of the stuff you’ve tried. My main issue at the moment is connecting the pi to the powered up hub via Bluetooth – I can never establish a connection. I was wondering if you could give me some pointers either on what to do or where to look to find answers. Thanks
Hi!
If you have a recent RPi it should have a BLE 4.0 compatible hci device.
I suppose you are using Raspbian linux.
Check for the presence of the hci device with “hciconfig -a” and if is “up” the scan for your Powered Up hub with “hcitool lescan”, you should see the BT address of your hub (don’t connect your app, it will lock it).
Then it’s really just a matter of using the same gatttool commands I use, just changing my BT addresses for yours.
If / when that works, then you can try python later but for now bash / command line is better (and faster).
Hi,
I am programming an app for powered up and I know you have some experience with PU HEX codes.
My question: Do you know the command for getting the battery value, so I mean the remaining power of the battery and the command for changing the name of the hub? Thanks in advance;)
Hi!
To change the name you should send a “Hub Property Message” (0x01) for the “Hub Property Reference” of the “Advertising Name” (0x01) using the “Hub Property Operation” SET (0x01) and then the payload. So if you want to rename to “ABC” (0x41 0x42 0x42 ASCII chars) you should send an 8-byte message:
08 00 01 01 01 41 42 43
Hi,
I am working on an android app for PU.
My question is: What is the command to change the name and the command for reading the battery value? It would be very nice, if you would help me to answer this question;)
P.S. I have read the PU documentation on GitHUB, but I still don t understand it:(
Hi.
You should send a “Hub Property Message” (0x01) including as “Hub Property Reference” the Battery Voltage (0x06) and as “Hub Property Operation” the command (0x02 for “enable updates” or perhaps 0x05 for “request update”). Since these commands have no extra payload they are 5-byte long messages:
05 00 01 06 02/05
I used Nordic nRF Connect on my Android phone and connected to a PUp hub, enabled notifications (tap the right icon with 3 arrows pointing down) and then sent “0500010602” (the middle icon with the single arrow pointing up) and got “060001060664”, that means I got back a 6-byte long “Hub Property Message” returning an update of the “Battery Voltage [%]” with the payload on the last byte so 0x64 = 100% Battery.
Hi! Could I ask you about MicroPython + EV3? Does USBport work correctly for webcam? If it’s ok can we use OpenCV framework? Is computational power (for vision data processing) of EV3brick going to be enough?
Thank you in advance)
Micropython cannot use directly the webcam. Not because it doesn’t work but because micropython has no modules for that purpose (AFAIK). Same for OpenCV. But python (regular python 3) work, you just need to use full ev3dev environment instead of just micropython. But OpenCV is heavy… last time I installed in ev3dev took lots of time and recognizing my face (Logitecg C170 webcam) took 3 or 4 minutes.
Better if you use OpenCV on a Raspberry Pi or a laptop and command the EV3 from there.
“Better if you use OpenCV on a Raspberry Pi or a laptop and command the EV3 from there.”
Is the connection between the RPi (laptop) and EV3 via Bluetooth? In that case, do I have to install ev3dev or micropython is Ok?
Can be but I like to use Wi-Fi. When you use the micropython image on EV3 you are already using ev3dev, LEGO released micropython over a standard ev3dev image. But if you use OpenCV on the RPi you need to run linux, can be standard Raspbian image from the Raspberry Pi Foundation or ev3dev custom image. If you choose a laptop, can be any operating system you like and feel confortable with, as long as it supports OpenCV. If you are going to control the EV3 from a laptop, you don’t need micropython/ev3dev/linux on the EV3 side, native firmware (I mean no microSD card at all) is enough as long as your code can talk with your robot (through USB, Bluetooth, Wi-Fi…)
Thank you, Jorge!
Hi! Please tell me what model of USB hub you use in your experiments?
Any USB 2.0 Hub will work but this one is a cheap 4-port hub I found at a local store, from a white brand – I have just this one, never found another. It looks very similar to this Belkin Ultra Mini Hub
https://www.walmart.com/ip/4-Port-USB-2-0-Ultra-Mini-Hub/13062577
Hey can you please help me I was looking for a stage light prototype electrical connection for our project and then I was thinking about making a stage light so after I saw your lego stage lighting I thought I could do it so can I ask what were the things you used in it? Because our teacher told us that we should use an LED, connection wires and 2 pcs of 1.5 battery.
I used LEGO lights, they work with 9V and have internal resistors to protect the LED from burning. If you are going to use a common LED and 2x 1.5 battery, you also need to add a resistor to limit the current passing through your LED so it doesn’t burn. Suppose your LED works at 1.7 Volt, the 2x batteries will generate 3.0 Volt so you will have 3.0 – 1.7 = 1.3 Volt on the resistor. If your LED works fine with a current of say 0.05 Ampere then the resistor will have a value of R = 1.3/0.05 = 26 Ohm, you can safely use common commercial values like 22 or 33 Ohm (lower values means higher currents and brighter lights).
And if you want several lights, just multiply everything except the batteries (so for 10 lights use 10 LED and 10 resistors).
If not sure, ask you teacher for guidance.
Thank you so much for your help sir:)
Hello Jorge,
I love your work. I’m not super at Raspberry Pi but have build a Magic Mirror and currently working on LEGO Minifigures Jukebox for my grandson; here is site: https://codeburst.io/my-lego-minifigures-play-spotify-dc397e83280e. I can’t get the LEGO Dimension Pad to work and came across your site here: https://wasabifan.github.io/ev3dev.github.io/docs/tutorials/using-lego-dimensions-toy-pad/. Can you tell me how to get the LEGO pad to work? I’ve done everything as described in instructions but can’t get the LEGO pad to read the NFC. When I plug the LEGO pad into the USB port, there is a short blue color flash, but nothing is read. I hope you can help me understand what’s going on and help me get this working for my grandson. Thank you!
Hello Joel.
Please give a few days to find my LEGO Dimension Pad and try it again… a few years have past since I last used it and probably some dependencies have changed.
There’s also a difference between the Xbox version and the other versions (Playstation/Wii), not sure what version are you using.
Hello Joel.
I got my LEGO Dimensions back, and working.
I will publish a new guideline soon but it isn’t much different from that old howto – just installed “python3-usb” and rewrote the python script to use python3 instead of python2. The most important step is still the udev rule (SUBSYSTEM==”usb”, ATTR{idVendor}==”0e6f”, ATTR{idProduct}==”0241″, MODE=”0666″) to allow access to the USB device without being root.
Hello! I stumbled across one of your old videos of LEGO Peristaltic Pump and have been attempting to recreate for a project I am a part of. Our designs our super similar however ours is not pumping any water. Do you have any recommendations?
Hi! For me the hardest part was the tube. It needs to be flexible/soft but also wide enough to hold in position (the pump motion tends to pull/push it) . Some aquarium and some LEGO I tried weren’t good enough. I found that medical tube worked quite good, it has the same outer diameter of LEGO tube but a larger inner diameter which also allows more flow.
Also sometimes it helped to create some vacuum before starting the pump – when using plain water, I used my own mouth. But never had to do it with medical tube.