I will now explain how to connect a smoke engine to the Powered Up Hub – a method that can be used for several type of electric or electronic devices, not just a smoke generator.
First we need to remember the pinout. I show here the female plug on the hub, it’s easier to see the pins:
Thanks to JopieK who opened up is PUP Train Motor for the good of science we already know the names given to each pin by LEGO:
1 – M1
2 – M2
3 – GND
4 – VCC
5 – ID1
6 – ID2
These are the names from the Train Motor side, not necessarily from the Hub side (some of us suspect that pin 5 and pin 6 combine Analog Input and UART functions). For this post purpose these names are enough.
So to emulate a PUP Train Motor we just need to short ID1 to VCC and ID2 to GND and use the M1 and M2 pins:
So I used a PF2 available cable (don’t ask) and stripped the insulation off, joined wire 3 to wire 6 and wire 4 to wire 5 and soldered these two junctions:
Then used heat shrinking tube to isolate these junctions:
The two remaining wires can now be used to control anything we want with a PWM signal of near 9 Volt (from M1 to M2 or M2 to M1, depending on the direction we choose for the “train motor”). This is the same signal of Power Functions so if we want to connect a LEGO PF motor we just need to connect these two wires to C1 and C2 of a PF connector.
But I want to use a Seuthe Nr. 99 smoke generator for H0 scale trains:
This little device operates with a voltage between 8 and 14 Volt and consuming around 140 mA. My previous experiments with PF revealed that I would need more than just 8V so direct attaching it to a PF cable wasn’t enough, I needed a boost circuit to raise voltage a bit – I used a small circuit and trimmed it to ~11.2 V.
It worked quite well with my PF version of the BR80 so I just reused the circuit, replacing the PF cable with this PUP cable:
The rectifier bridge is not really needed since it’s function is to prevent damage to circuits that don’t work with negative voltages when we reverse the direction of the “motor train” and the Seuthe generator is a passive device that copes well with negative voltages. But it was already soldered to the boost circuit from a previous attempt with other devices so it stayed. And if I decide to use a sound circuit instead I just need to replace the Seuthe and keep the rest of the cable.
So how does it work?
Since we are using the same AutoID of the PUP Train Motor, the Hub will notice it as such when we connect this PUP Smoke Engine. So if we use a PUP Handset we just need to press + or – button a few times until the “train motor” receives enough voltage for the boost circuit to work and heats the Seuthe to produce smoke. Same if we use the LEGO App… unfortunately with my BR80 the App doesn’t work because the PUP M motor is not accepted as a valid train motor.
A few months ago I have made my own version of Holger Matthes’ BR80. It was not a full replica because I didn’t have all the pieces required so I had to improvise. I also opted for an all-black version instead of a black+red combination.
I decided I needed a steam engine after some experiments with a MINDSTORMS EV3 setup with a train turntable, two rail switches and a pseudo train with SBrick and RFID:
After I added a mechanism to disengage the train engine from the cargo wagon I decided I needed a steam engine since modern trains don’t need the turntable to operate.
As the SBrick had 4 outputs and I was only using 2 for the motor and the lights I wonder what else could I add to it. Choosed two extra functions that would look good on a LUG exhibition:
a smoke engine
The initial project was dismantled but I’m now returning to it with a MILS-based layout to use in larger dioramas with other PLUG fellows:
Currently the turntable and the rail switches are still manually operated but at least I now have a steam engine. With real smoke:
This is ‘Gatto Negro’. It means ‘Black Catt’, I’m using the extra ‘T’ because in Bluetooth Low Energy jargon ‘GATT’ means ‘General Attributes’ and I’ve been using a lot the linux command ‘gatttool’ to quickly test my BLE devices.
Of course ‘Gatto Negro’ is also BLE – it uses the new LEGO Powered Up hub and the PUP version of the LEGO Medium motor instead of the Power Functions IR Receiver, LiPo battery and M motor.
Unfortunately with the current firmware of the PUP Hub using a M motor isn’t the best option: the remote BLE Handset doesn’t hold the speed setting so we have to control the train with short or long button presses, always at full speed. Same happens with current LEGO App because LEGO programmers decided that only a train motor should be used for trains (each PUP device has an unique AutoID and the App was made to use train motors with train controls and non-train motors with car controls).
So I made my own ‘Gatto Negro’ aplication, with MIT AI2.
Next posts I’ll write about the smoke generator and the App.
Already tried a 3A model but it was a dual USB port and no info about each port limit, I suspect it is 1.5A for each.
So I started charging my EV3 again, with ev3dev running. But removed the USB hub and the CRS 4.0 dongle, left just the Edimax wi-fi dongle. Also disconnected 2 large EV3 motors I had:
163 mA (43 mA less than previous attempts)
Is started from last night “full” charge with same Qi emitter and receiver (but EV3 OFF), 7.23 Volt
After 45 minutes it charged to 0.1 V more (7330466). After that it slowed down but still charge up to 7350466 exactly 1h57m after.
Then it started to behave strangely again, discharging to 7262466 after another 35 minutes. Then it stayed there for the next 20 minutes.
Both RED and GREEN lights are ON (EV3 battery). And the Qi devices seem coupled.
7.26V is just 0.03V more than last night “full” charge result. Perhaps it is the best I can get with the boost circuit’s output trimmed to 9.02V.
If that’s the limit, then using a better USB charger and/or reducing EV3 current consumption by 43 mA helped. But it still isn’t enough for a mobile robot, adding a couple of motors and sensors will raise consumption above the nearby threshold and the robot will just discharge slower until it shuts down.
I wish the EV3 had a Real Time Clock and wake up function. Crazy ideas accepted 🙂
The Qi emitter is using a 2A USB charger. The LED shows it is coupled with the Qi receiver. For the first 15 minutes or so it charges a bit but no more that 0.1V… then it starts discharging. After 3 hours, the ev3dev turns itself OFF.
Tried a different Qi emitter. Also a few different USB chargers. The Qi emitter gets hot. Sometimes one of them blinks, I thought it was a coupling problem but now I think it is an overcurrent or thermal protection…
Not sure about the efficiency of this Qi couple and also not sure about the efficiency of the boost circuit… I suspect that I need more than 2A through the emitter to get a full charge and they can’t handle it more than a few minutes and then they “throttle” current.
I trimmed the boost circuit to give 9.02 V instead of 10.02 V. Less voltage should mean more current available but didn’t notice any effect.
Last night I left the battery charging with EV3 off (it had not enough charge for ev3dev to keep running) . This morning the GREEN light was ON and the RED was off so it charged. Turning EV3 ON it reported
So the battery is not quite full charged but much better than what I get with EV3 ON.
With a small 4-port USB hub, an Edimax wi-fi dongle and a CSR 4.0 BT/BLE dongle the ev3dev reports 208 mA
I plan to get a current meter and watch consumption with several dummy loads. Perhaps I can tune my gadget a bit but I think I’ll have to find a better Qi receiver (and probably also a better Qi emitter).
So, for now, Juan’s idea of using this for charging an autonomous Ev3 robot is paused. The better we can do is bringing the robot to the charging point and turn it OFF to let it charge. But someone has to go there to turn it ON again after charging is complete.
It’s a “Targus Bluetooth v4.0 Dual-mode Dongle ACB75A” that is sold at Staples.
usb 1-1: new full-speed USB device number 9 using xhci_hcd
usb 1-1: New USB device found, idVendor=0a5c, idProduct=21e8
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: BCM20702A0
usb 1-1: Manufacturer: Broadcom Corp
usb 1-1: SerialNumber: 5CF370878D54
Bluetooth: hci1: BCM: chip id 63
Bluetooth: hci1: BCM: features 0x07
Bluetooth: hci1: BCM20702A
Bluetooth: hci1: BCM20702A1 (001.002.014) build 0000
bluetooth hci1: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2
Bluetooth: hci1: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found
I got my script working with 6 LEGO BLE devices. And 7. And even 8:
But latency isn’t great (with 8 I had to decrease the loop period from 1 second to 0.25 to prevent connection drops and even send the initial command twice to the Handset to hold the session) so even if it supports 14 sessions I doubt that we can make good use of 14 LEGO LPF2 hubs with just one dongle.
To reduce latency we can add more dongles. But even so, when a command takes 0.2 to 0.3 seconds to complete before we can send the next one, it’s hardly interesting for robotics. A Powered Up based robot will require a real autonomous device, able to read its own sensors and react on the fly, not with half a second round trip delay to the “brain”.
Also tried the script without the firmware. It works but with a few “connect error: Function not implemented (38)”.
And also re-tried the Cambridge CSR 4.0. It clearly states that it can’t handle the sixth: “connect error: Too many links (31)”
About two years ago I had a dual SBrick “train” setup controlled with my EV3. I never really got much far because there were some hiccups when using one USB BLE dongle to control two SBrick at the same time that didn’t occur with my Ubuntu laptop (same dongle, a CSR 4.0).
By that time, the ev3dev had a BlueZ stack much older than my Ubuntu so I decided to wait and as usual I forgot about it.
Today I’m testing how many Powered Up hubs I can control at the same time with just one BLE “client”. Just a simple bash script, changing the RGB LED colors of the hubs at the same time.
My laptop could control 2. But started to had issues with 3, failing some commands:
Characteristic Write Request failed: Request attribute has encountered an unlikely error
Perhaps sending 3 gatttool commands in-a-row was too much so added a small delay. It got worst:
connect error: Connection timed out (110)
Tuning to a small delay (0.03) seems to be the best but is strange.
Now this laptop is no longer the same I had and it now has an onboard BLE 4.2 chipset, from Intel. Not sure which version.
But I still have the CSR 4.0 dongle on the Ev3 over the desk. So let’s try same script with it.
No errors at all. Not even with 0 delay.
These last years David has been doing a great job with ev3dev kernel so my EV3 and my Ubuntu laptop are now pretty close: (4.14.58-ev3dev-2.2.1-ev3 against 4.15.0-29-lowlatency #31-Ubuntu SMP PREEMPT) so I don’t think this is a BlueZ issue.
I read somewhere that CSR 4.0 allows 5 sessions. So I need to test my script again with more LEGO hubs. But wonder why the Intel only handles two.
Buy the way, controlling 2 Powered Up “Hub NO.4” and 1 BOOST “Move Hub” at the same time from a single EV3 is already pretty good (if the old hiccups problems are fixed): that’s potentially 8 more motors!
I have news, because i did a test. The Broadcom BCM20702 Bluetooth Dongle can handle up to 14 BLE device connections simulateous.
And overall it’s a lot faster than this one from Cambridge Silicon Radio (can handle a max. of 5 BLE device connections simulateous).
Need to search my drawers… almost 100% sure I had a Broadcom LE USB dongle that gave up because ev3dev didn’t like it as much as the Cambridge CSR.
Also Raspberry Pi is Broadcom… time to get back to BrickPi3.