Raspberry P(s)i

SpikeG

New member
Figured it was about time to start our own thread. A group of 4 of us are working on an electric supercharger for a senior design/capstone project for EE/CPE undergrad. We're doing a P2 supercharger build based off all of AlexLTDLX's hard work as we only have 4 months to complete the project.

Our plan is to control everything via a Raspberry Pi (RPi) which will connect to the vehicle via OBD-II. Our goal is to have a RPi mounted somewhere in the vehicle with a small touch screen to control boost. We will have user selectable 'profiles' to tweak the driving mode such as 'race', 'economy', 'sport' etc. The profiles will focus on control via different parameters such as rpm/throttle position based, pressure based, ramp-up/down times. We are going to use a pressure sensor mounted on the compressor housing to read boost pressure and control via PID as well.

Given cost and time restrictions, we're going with a LiPo battery setup without onboard charging. I, personally, will be keeping the project after it is 'complete' to continue integrating it into my vehicle with a permanent battery/charging solution but the goal of this project is to control the supercharger on the fly as if it were a commercial product.

This thread will serve as a photo dump and lessons learned throughout the project.

 
Last edited:
Mid way into the project our build sheet added up quickly. We already had a LiPo charger, RPi's, some wires, misc hardware etc. We're using a Castle Sensored 2028 4 pole motor and HobbyWing MAX4 ESC. For batteries we are using 2, SMC HCL-HP 22.2V 9500mAh 150C, 6S batteries in series for 12S total.


ItemQuantityPrice/UnitNet PricePurchase LinkManufacturer Specs/Notes
Super Charger1625625https://www.amazon.com/gp/product/B01N2HGXJJ/ref=ox_sc_act_title_2?smid=AK4YPSR6DNML&psc=1https://www.speedmaster79.com/P-2-Centrifugal-Supercharger-Without-Gearbox
High Speed Motor1260260https://www.amazon.com/gp/product/B...c705337b79597&language=en_US&ref_=as_li_ss_tlhttps://www.castlecreations.com/en/castle-2028-sensored-motor-800kv-060-0064-00
Electronic Speed Controller (ESC)1450450https://www.amazon.com/gp/product/B09YFXK12R/https://www.hobbywingdirect.com/collections/ezrun-max4-system
ESC Data Logging Cable16060https://www.amazon.com/Hobbywing-OTA-Programmer/dp/B08NXX2MDYhttps://www.hobbywingdirect.com/products/ota?variant=32088351506547
Rubber Coupling for Supercharger Outlet12525https://www.amazon.com/dp/B00UCKQNX6/SC outlet 2.75"
Bluetooth/usb OBDII Interface12222https://www.amazon.com/Forscan-Scanner-ELMconfig-FoCCCus-Diagnostic/dp/B07MQ8GHG3/
Fireproof Battery Bag11010https://www.amazon.com/HOOVO-Battery-Fireproof-Explosionproof-Protector/dp/B0B4SGTRDC/
Air Pressure Sensor127.727.7https://www.mouser.com/ProductDetail/Honeywell/ABPMANV015PG7A5?qs=l9vRkkPGK2l9/XgKzvvteg==
T5 Timing Belt11515https://www.mcmaster.com/1679k453/https://www.mcmaster.com/catalog/129/1317/1679K453
Pulley T5 36T5/18-212020https://www.mcmaster.com/1428n62/https://www.mcmaster.com/pulleys/for-belt-trade-size~t5/
Alternate Pulleys (15, 16 tooth)2510https://www.aliexpress.us/item/3256804502868990.html
Super Charger Shims122https://www.aliexpress.us/item/3256803366306154.html?
Lipo Batteries2180360https://www.smc-racing.com/index.php?route=product/product&path=119&product_id=719
Misc Electrical Connectors130https://www.ebay.com/itm/133940618311?Castle 6.5mm 200A connectors
Power Wires0Sourced Locally
Motor Mount Plate100University Machine shop1/4" aluminum plate
Motor Standoffs240University Machine shop1-1/4" aluminum roundstock
Pulley Machining140University Machine shopBore to 8mm, set screw
Benchtop Mount160University Machine shop3/4 Angle Iron
Misc Hardware30Various Sources
Raspberry Pi 3B+100Already Owned
Total2186.7
 
Last edited:
As soon as the parts came in we started designing and testing various motor mounts. After some calculations, we decided to go with a 245mm T5 belt from McMaster. Since we'll be testing this on a small engine (2.8 i4), we're not too concerned about hitting 5p.s.i. given the supercharger outlet will be pretty restricted. We opted for a 14 tooth T5 pulley from McMaster which comes with a 6mm bore. The Castle motor has an 8mm shaft so this needed to be machined as well. We ordered a 15 and 16 tooth pulley from aliexpress that comes with an 8mm bore and set screws already but didn't want to risk shipping times to the U.S. and have them be our only option. (They got here in time regardless).

After some solidworks iterations and talking to the machine shop, we decided to go with a slightly beefier version of our design so deflection won't be an issue when it's mounted in a vehicle. We started by printing multiple different prototypes and testing mock-ups. Luckily we have a discounted rate at the machine shop on campus so we had the parts CNC'd to higher tolerances than we were able to produce ourselves. We ended up recreating the supercharger/motor in solidworks to aid in the design process.

Image dump:






 
Last edited:
In the mean time we have been working on the OBD data to the RPi, and the PWM output as well.

The RPi has two modes for PWM output, software based, and hardware based. The ESC uses a standardized servo protocol of 50Hz where a 1ms pulse (5% duty cycle) is 'zero speed' and a 2ms (10% duty cycle) is 'full speed'. We decided to simulate a 'throttle pedal' in the lab by hooking a potentiometer to the RPi and using the voltag to control the servo PWM output. We needed an analog to digital converter (ADC) since the RPi doesn't have one for some reason.

First we tried using software PWM via Python on the RPi to power a small 5V servo motor but the output was jittery. We put the PWM output to an oscilloscope and found the frequency was jumping around a little but consistently low at 49Hz. The duty cycle was also varying slightly. The ESC requires you to 'calibrate' the PWM signal so it knows where brake/neutral/full throttle is before you can run it and it would not recognize the PWM signal. For the HobbyWing ESC, it would give an error light of consistent flashing red which indicated invalid throttle signal from the datasheet.

We switch to hardware based PWM and the signal was much more clear and exacly 50Hz. With hardware PWM enabled, we were able to sync the ESC. In order to sync, we had to leave the potentiometer in the middle (~1.5ms pulse [7.5% duty cycle]) to indicate neutral as the ESC requires a 'brake' pulse which is lower than the neutral position.

We built a simple test script for the OBD readings and are currently using a OBD to USB cable from amazon. We're torn on if we'll keep it wired or go to a BlueTooth solution for the final version. If we keep it wired, we'll have to chop the cable up to tap into the 12v line to power the RPi in the final iteration.

 
Last edited:
Since we're using pressure as a control variable we had to find a sensor that would work for our needs. We went with a honeywell I2C sensor thats capable of 0-15 P.S.I.
The RPi had to be configured to communicate via I2C in a startup config file. We tested the sensor via a python script and have pressure readings currently.

We designed a quick detach system for the sensor since we'll be working on this often. The plug on the supercharger outlet is 1/8 NPT. We found a 1/8 NPT to 4mm tube quick connect fitting, similar to those used on Bowden Tube setup 3D printers, which was rated at 150 P.S.I.. I chopped a small portion of teflon tube (4mm OD, 1.8mm ID) and press fit it over the sensor barb.

Everything fit perfectly but to avoid any issues with the barbed fitting backing out under pressure we designed a locking clip that fits behind the collar of the quick disconnect tab and also prevents the sensor from moving backwards. I printed the retaining clip out of PETG to give it some chemical/heat resistance

Waterproof connectors get here tomorrow for soldering/potting

Image dump:






 
Last edited:
I posted this in the P2 thread but I'll put it here for continuity. When we went to do our initial spinup test, the impeller of the supercharger started to foul on the compressor housing. Turns out, the chinese clones aren't 100% on the QC but no worries. If you have this issue and don't want to read this whole wall of text, the solution is to buy some M17x22 shim washers
Solving this required a full disassembly which was pretty straightforward. The teeth are machined directly into the impeller shaft, the runout bearing is pressed on tightly, and the spacer that sits on the inner race of the backplate bearing is loosely fit on the shaft. This was concerning before as it is not tight enough to remain concentric and I'm worried it will cause balance issues.


First thing I did was get some dykem and see where the impeller was rubbing on the back plate


Then, started thinking about making a spacer so the inner race would hit the back of the impeller without letting the impeller hit the backplate... then I realized I was making a mistake. The cover plate (and housing for the runout bearing) prevents the shaft from backing out. duh. I reassembled and sure enough it prevents the impeller from rubbing the backplate with no issues so I'm only worried about the impeller moving into the compressor housing (which it certainly was).

I decided to remake the spacer that goes against the gear teeth and inner race to proper spec. I reassembled and measured everything to see how much I needed.


In the end it was 0.7mm too short (I'll double check when I have it apart again). I made it slightly oversized but when the cover for the pulley was tightened, it made the bearings difficult to turn. After some lapping, it now spins freely and does not shift laterally. I think they expected the bearings in the backplate to be press fit tight enough to hold but their machining on the impeller shaft was less than perfect. Overall a fun project as this is a bit out of my wheelhouse as a EE.

The same thing could be accomplished with some M17x22 shim washers such as these:

I ordered some to test fitment. I'm hoping the runout bearing can be removed easily because it would allow me to trim the pulley position.
 
Initial spin tests went well. We ordered some nicer hardware to make it look more professional as well. Next step is measuring full load current draw, pressure output with various restrictor plates, impeller speed, motor speed. We have a clamp to mount the setup to the test bench, fireproof bags for the batteries, and are building a plexiglass enclosure to prevent it from inhaling any loose jumper wires.

Image Dump:





 
Last edited:
Some of this will be specific to our build but since I've been in and out of this thing so much I decided to catalog the fasteners used for quick reference

PartPitchLengthHeadMaterialWasherQuantityTool
Backplate to CompressorM6x115mmSocketStainlessSplit Locking45mm Allen
Runout Bearing HousingM8x1.2555mmSocketZinc CoatedSplit Locking36mm Allen
Spindle NutM10x1.25-HexStainless/NylonCopper Crush Washer117mm Socket
Spindle ShimsM17x220.2mm-StainlessShim3-
Motor Mount to Backplate3/8x163-1/4"FlatStainlessAluminum Countersink27/32 Allen
Motor to MountM4x0.712mmFlatHardened Steel-82.5mm Allen
Motor Deflection ShimsM4x80.1mm-StainlessShim3-
Belt Tension Screw8-323/4"-Stainless-13/32 Allen
Pulley Set Screw8-323/16"-Stainless-13/32 Allen
Outlet pressure barb1/8-27 NPT3/8"-Zinc Coated-13/16 Allen
Bench Stand3/8-161/2"SocketStainlessStainless39/16" Socket
 
Last edited:
I'm one of the other members of this group and was the one to design all the stuff in SolidWorks. Figured I'd add some more pictures of the assembly.

We couldn't find any drawings/measurements of the P2 Supercharger, so had to measure and model everything from scratch, and this is what we came up with. The dimensions are millimeters.

If you're going to use this please note that 93.75 is at an angle (it's the direct length between the two centers). I would like to also mention that my measurements are obviously not perfect. We designed the bench stand so that it attaches to the 3 holes at 85mm radius, but it was off by about 1mm, and was fixed by giving it 1 ugga dugga from the drill. I obviously cannot guarantee anything if you do choose to use my measurements or models. Everything except the bench mount fit perfectly for us, can't promise that it will be the same for everyone.


I've attached the zips of all the models we've used, hopefully they can be of use. I included the SolidWorks files as well as the STL versions of them, which should keep the 3D models consistent across the different platforms. If you'd like me to convert them to some other file type, I will gladly do so. The folders should be pretty self-explanatory. I am not the maker of the original pulley model, but included it since we had to modify it to fit the motor shaft. I was going to include the assembly file, but it was too large to attach, and not sure whether it's really necessary since I've uploaded all the files.
 

Attachments

  • MotorMount.zip
    756.7 KB · Views: 2
  • PressureHousing.zip
    187.9 KB · Views: 1
  • Pulley.zip
    732.3 KB · Views: 1
  • SuperChargerBenchmount.zip
    140 KB · Views: 1
  • SuperChargerPlate.zip
    686.5 KB · Views: 1
YEAY ! SUPERRR!

Btw ... just a quick comment re OBD->RPi : IFF you go BT, remember: standard BT (serial) stacks are not known for connection reliability and speed! ELM chips are not "fast" enough either ... if you want to close the loop reliably to your ECU data channels: stick to direct link. (makes it easier under linux as well!)

BUT if you reaally want the cool factor: check out the faster BT OBD adapters like OBDLink MX+ (and higher). They are fast and reliable enough to be used to "flash ECUs for tuning purposes" without bricking the ECUs. Well I got both ... the OBDLink SX direct serial/usb ... werked out of the box with my ODROID RPi ... and the OBDLink MX+ BT adapter which I used to flash my friends Triumph Rocket 3 ... its just that BT stacks under linux suck a bit...

oh ... and if you want to kick some more ass:
configure your RPi as headless apple car play source ... directly to your car play capable in dash infotainment system!
(Yes IT IS even easier than hacking Android Auto and Apple Car Play has the better "life cycle")

Just imagine the cool gauges/dash boards you could display and control on your in car infotainment screen!
And for apple car play there is not so much "risk" (as with closed loop control via BT OBD) to go wireless!
(now add to the typical ECU data channels of interest on seperate "tabs" the gauges for the key VESC data logs and for the Battery Managment/state Module ... hehehe)
 
Last edited:
Thanks for the info! I agree, sticking with the direct OBD plug in seems like the way to go forward. I'll probably buy another cable soon to cannibalize and tap off the 12v line with a buck converter for the RPi's power source. We're going to be cutting it close on time as we present one month from today and some of our team members are leaving for a week. The Car Play source is a fantastic idea, I will definitely be doing my homework on this one. We've got a 7" touch screen currently as it was available to us through the university so the gauge dispalys are already in the works. One big hurdle we have is figuring out how to get the data from the hobbywing, it seems mostly proprietary and our curriculum doesn't exactly steer us in a useful direction as far as programming goes (we start at C and go down to assembly from there) so there's a steep learning curve. It's most of our teammates first time using python even.

On another note, we just did our first full speed run to test max currents and the impeller speed with the 14 tooth pulley. Alex wasn't kidding when he says this thing is terrifying. Hearing protection is 100% necessary after about half throttle. We hit 37,411 motor RPM with a 14/18 ratio so 29,047 impeller RPM with a restrictor plate with a 1" hole.

 
Last edited:
Wow. TBH, I've been so swamped with everything else I've not had much time to keep up with the forum. But after quickly flipping through this thread, I have to say I'm hugely impressed. Love how your setup looks. I can't wait to take the time to read through this in detail... fantastic job!
 
Just went through it all - again, fantastic work. I love the motor mount in particular, and am curious how your Pi controller works out. I do have a couple of questions - what was your voltage on the run in the video (can you post a datalog screenshot - I'd like to see the curve); I'm also not sure why your current readings were a good bit lower than mine (I was around 140 amps), even though both hit almost the exact same rpm - could be your additional work on the bearings and all - but what are your thoughts? And finally, I see a fair amount of noise in your input signal. Do you think that's coming from the ESC/cables? On our first dyno test, the MGM ESC and cabling put out enough EMI to shut down the dyno, and on our first full power track pass, the arduino went a bit screwey.
 
BTW - if your test engine replicates the 1" restrictor performance, you can "pulley up" and get more impeller rpm until the battery current and the phase currents start to diverge. In other words, there's more on the "electric supercharger table" if the input current and the phase currents stay similar (motor duty cycle near 100%).
 
And one final thing - running it without the restrictor is much scarier in terms of violence in the immediate vicinity - give it a shot... :)
 
Just went through it all - again, fantastic work. I love the motor mount in particular, and am curious how your Pi controller works out. I do have a couple of questions - what was your voltage on the run in the video (can you post a datalog screenshot - I'd like to see the curve); I'm also not sure why your current readings were a good bit lower than mine (I was around 140 amps), even though both hit almost the exact same rpm - could be your additional work on the bearings and all - but what are your thoughts? And finally, I see a fair amount of noise in your input signal. Do you think that's coming from the ESC/cables? On our first dyno test, the MGM ESC and cabling put out enough EMI to shut down the dyno, and on our first full power track pass, the arduino went a bit screwey.

Hey Alex, first off, thanks for all the time and money you spend figuring out a combination that works well enough to let us start at this level.

We ran those tests pretty late on Friday night and left before we could really figure out the hobbywing app. I had assumed the data logs would be stored on the phone under the Data-Log section but after some reading it looks like they're actually stored on the ESC itself. I wont be at the lab for a couple days but I'll post the charts when I do.

We've been talking about the current draw since there seems to be a discrepancy between the fluke i400 clamp meter measuring a phase current of the motor and the Hobbywing app. I wont draw any conclusions until we look at the actual charts but from flipping through the video, the hobbywing says we maxed out somewhere in the 120 to 130 range for amperage while the fluke was almost 10amps lower. Could be a resolution issue for the fluke? We started the text right after a full charge to 25.2V per pack. there was a slight line loss but the ESC saw 50.2V before the initial tests. Again, just by flipping through the frames of the video it looks like our battery voltage under full load was 48.1 min, not much different than yours either so we would have less kW total and same impeller speed. I did set the "punch" setting to '1', but I don't think that will ultimately affect the physics here. The only thing I can think of is somehow our impeller is more restricted than yours? Tightening the tolerances might have something to do with it but I doubt you had the same issue as us since it would have been a rapid unscheduled disassembly video instead.

As for the PWM signal, the RPi uses 3.3v logic which I'm somewhat surprised is working without a level shifting circuit since the hobbywing is expecting between 5 and 6 volts. The noise is definitely changing when we're running but peak to peak deviation of the noise stays right about 700mV (+/- 350mv). I don't think this is going to be an issue since the RPi will be so far away from the ESC and we're using a shielded/twisted cable to go from the pi to the engine bay. Typically the rising edge would trigger well above 1V and falling edge well below 2V so we should have plenty of room for noise but it's an easy fix to boost the voltage. I'm not sure how to measure total EMI but I suppose some shielding could be figured out if necessary.

We have a 15 and 16 tooth pulley ready if necessary but we're going to be running this on a 2.8 motor with about 200HP stock so gearing up would mean we'd have to keep the motor running at a lower duty cycle to not detonate my daily driver (buy hey, what an excuse to finally do that 6L swap).

Lastly, we're doing this in a shared lab space and its spring break week right now so the lab is empty. This is the perfect week to run full throttle tests without terrifying our fellow classmates or drawing attention from any stray OSHA workers so I'll definitely run it wide open 'for science'.
 
Last edited:
I just went and measured my HOLE. (too easy for jokes...) I must have used a boring head because my HOLE is exactly 1.000 inches. Like to the thousandth. So if your HOLE is smaller than my HOLE, that might explain why your current readings are a little lower. What batteries are you using, btw? (edit: nm; saw the smc link in your bom) Also, with longer cables you may experience more EMI.
 
Last edited:
Assuming 48 volts, a phase current of 115 amps and a motor efficiency of 90%, the power input to the compressor would be:

48* 115 * 1.732 * 0.9 = 8.6 kW

Based on the Vortech V2 Si compressor map, the discharge pressure should be about 6.6 psig at 29,000 rpm. At 68% efficiency the air flow would be about 1400 lbs/hr as calculated by a compressor model requiring 8.6 kW of power input.

I'd like to calculate the flow based on the orifice size and pressured drop. To do this I need to know the orifice thickness and the I.D. of the hose that the orifice installed. Can you provide that data?
 
The problem is without battery current, battery power or duty cycle, you can't calculate actual power input (over any length ot time, anyway) to the compressor. The other thing I've discovered is that a simple hole doesn't do a particularly good job of replicating the dynamics in a running engine. And I don't know all the variables (or how to account for them) to make the data translatable. Also, without knowing at least your target hp, you can't guess what the boost pressure would be; all impeller rpm will tell you is theoretical peak boost. So at 29,000 rpm you could make up to 6.7 psi and 370 hp. Or you can make 0 psi and about 820 hp running into choke. Both conditions are possible at 29,000 impeller rpm; as is almost anything in between.

For example, with our Sledgehammer drag strip pass, we were seeing about 31,000 impeller rpm and about 5.9 psi at peak hp. Remember - this is with an actual Vortech Si trim, but with an upgraded billet impeller, which is lighter and a bit more efficient than the stock impeller. This points to about 722 hp at the crank, and is corroborated with fuel consumption figures from the car's datalog. We saw almost identical numbers on the dyno.

Now that was pushing the compressor into choke, so drive power was much more than it really should've been. And compressor efficiency was skewed towards the 70% island, but still in the 65% island.

HTH.
 
Top