Proton wrote: ↑Mon Aug 21, 2023 6:08 pm
Trying to learn some Arduino right now. Would you be able to make a video to see what parts and code is involved in making all the data to show up on that screen?
Check out videos on my Instagram page rambler_660e for other views of the devices. I can't film those now without removing my center console (bit of a design flaw).
Main parts: GS450h VCU, MCP2515 CANBUS module, Arduino Mega, Nextion 3.5" touch screen.
If wanting to use CAN, you'll need to learn the basics of sending and receiving that protocol. Nextion has it's own commands you'll need to write into whatever you're using to send it info, also you'll need to learn the basics of programming the Nextion. It has its own code loaded to the display. And... if you want to do anything looking like what I did, you'll need to know how to do graphic design. Most of the graphics you see in my screens are pictures loaded to the Nextion.
I am using one of the VCU's CAN lines to connect to the MCP2515 which is connected to the Mega. The Nextion is also connected to the Mega. There is code in my VCU that sends CAN messages out and reads messages coming in from the Arduino. For the MPH value for example, code in my VCU calculates my MPH based on MG2 speed and other factors (rear differential ratio, tire rotations per mile, etc) and sends that value over CAN to the Mega (through the MCP2515). The Mega then sends that value to the Nextion over a serial connection.
For things like Valet mode, the Nextion has dual state buttons programmed into it. When I press the Valet button on the display, it sends that information to the Mega (on/off). The Mega reads the value and sends it to the VCU over CAN. Code in the VCU then adjusts the max commanded torque based on whether or not Valet Mode is true (on).
For things like adjusting the set temperature of the HVAC system, I have a lever on my instrument cluster that moves a cable which moves a 5volt slide potentiometer. That pot sends 0-5v to a Mega analog read pin. The mega maps 0-5v to 65-75 numeric value that it sends to the display. The Mega also has code to turn on the heater or AC compressor depending on the relationship of the set temp to the cabin temp. There are a LOT of other inputs and outputs which is why I am using a Mega to control so many things. The VCU simply doesn't have enough I/O pins for my build. I have a LOT of stuff being controlled by the Mega. I also have a lot of "fun" info in my display. For instance, when I apply the brakes (or the VCU turns on the brake lights during heavy regen) the brake lights light up on my flow screen. Not needed, but definitely fun.
If you only want to display data (and maybe have a small amount of info going back and forth), @Gregski has proven that if you don't plan on using the WiFi module in the 450h VCU, you can attach a Nextion to the serial pins on the WiFi header on the VCU. That bypasses the MCP2515 module and the Mega, but limits what you can do with the display. And again, if you only want to display info from the VCU, you don't need a touchscreen. Nextion makes the same screen that is non-touch. Frankly you could use just about any serial connected screen, but the Nextion software makes creating text and number boxes very easy.