Jump to content

Arduino stuff/ programing/so cheap


flyingbrick

Recommended Posts

  • Replies 416
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

1 minute ago, flyingbrick said:

I do hope this doesn't happen as the melting temp of the glue is around 150 degrees 

I'd say it should be fine. Good thing about the hot glue is you should theoretically be able to remove it in you need to do any repairs or maintenance to the components within.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

I bought an arduino mega kit to tinker with, has been a bit of fun.

Then I bought a canbus shield, and after setting up some "send" frames in the ECU am receiving frames like this to the Arduino now: 

Get data from ID: 1
Data received: 12    73    69    0    37    0    0    0    

So just need to work that back into what the data represents.

And vice versa for using potentiometers etc to give a signal back to ECU.

Goal is to have a little tuning box thingy to adjust cam timing and ign timing at part throttle.

I ended up buying a display screen that has its own hardware/processing etc so all you are sending from the arduino is the values and it renders everything itself. 
Will be interesting to see if this makes any useful difference to framerate. But I'm understanding canbus and setting variables in the ardiuno code a bit better now.

  • Like 5
Link to comment
Share on other sites

  • 3 weeks later...

Picking up my screen today, will post up some stuff when it arrives and let you know if its shit or not.
I've been banging out some Arduino code for Canbus, it's been a bit of a mission.
Most of the example code that I've found just tell you how to read a single incoming frame, or send a single outgoing frame - not deal with the complexities of trying to do this both at once, reading/writing multiple frames and how to filter them, how to structure it, and best way to convert the frames into data values etc etc. 

One thing which was a real facepalm moment when I figured out what was wrong.
I was trying to use IF command to check for a particular can frame, and then do maths on the bytes to produce the data I wanted. 
But the data values were garbage as it would include all of the other frames for some reason.
Eventually I figured out that "If canframe = 11" is wrong, and it should be "If canframe == 11" 

A single equals means that its just declaring the current can frame as 11, so it was turning them all into 11 even if it was canid 25 or whatever. D'oh! 
I only realised this once I had done troubleshooting on just about everything else and decided to look up the syntax for the "if" command.

I've now got potentiometers writing to the ECU with a really awesome refresh rate and streaming the maximum amount of values from ECU back to arduino that the ECU can deal with. 
I still need to write some code to deal with some of the variables which are stored in only a single bit of a byte. (Basically on/off values for things)
I've still got a bit to learn about writing to EEPROM / SD card too before I'm done with this.
It's been a bit of a learning curve but feels like I'm nearly at the fun part where this all comes together.
I'm glad I got this code mostly finished before the screen turned up, or I'd be distracted with fiddling with this instead of working out the tricky bits.

  • Like 6
Link to comment
Share on other sites

I've done that if () error many  times :)

Where it looks OK, I now write 

if (11 == canframe)

{

}

because when I forget the == (read this as is_equal_to) and put in = (read as is_replaced_by) then the compiler throws an error.

  • Like 3
Link to comment
Share on other sites

Hey thanks for the tip, I'll keep that in mind! 

Initial impressions of the screen are that it's pretty sweet! 

could not be any easier to use, and the contrast rediculously good and viewing angles are great.
It's just drag and drop everything, compile it, then plug into arduino. Then get the arduino to spit the values for the gauges etc to the screen via the shield.
So worth the $$$ if it saves me many hours of ball ache trying to render basic items.

It's funny though, its a bit ghetto when it compiles. All of the gauges etc, it draws the dial in every possible angle and saves this as an image, then when it needs to show that angle on the dial it obviously looks up that image to display it.
It's passed every metric so far except for refresh rate, which I havent tested yet.
But that's arguably the most important thing and the area where running a screen direct from arduino processing power is a let down. 

The only thing that's a pain so far, is that when you compile the program you have to do it via sd card reader, you cant plug the screen in and have it write to sd card. 
So I can see myself adding/removing the sd card on the back of the screen about a billion times over coming weeks.

So there's no point in putting the screen in a nice housing until your design is rock solid.


Will hopefully have some dials swishing around tonight.

 

eqf43xav.zhf.jpg

3jwuksuk.yig.jpg
 

  • Like 6
Link to comment
Share on other sites

Oh yeah I've been hesitant to post a product link here until I've been fairly certain that it's not garbage, but seems decent enough so far.

Using this arduino shield:

http://www.4dsystems.com.au/product/4D_Arduino_Adaptor_Shield_II/

and then one of the Gen 4 HMI Display Modules, need the starter kit so you get the right cables etc

http://www.4dsystems.com.au/products

Keep in mind that although they sell stuff under "arduino kits" some of these use the older screens which are shittier.

So better to buy the shield and screen seperately from the "Gen 4 HMI Display Modules" section to be sure you're getting the best... thing.

Disclaimer: I've not actually managed to send any data from the Arduino to the screen successfully yet, so I'll edit this post if it turns out that one or both of the above end up being shitty.

  • Like 2
Link to comment
Share on other sites

Almost have the housing finished. 

1umgdgsi.erk.jpg

It was annoying having the take the shield off every time I wanted to communicate to PC with the arduino (they both use serial port) 

So bent some pins out of the way and ran some leads to one of the other serial ports for it. Should make it much easier as now I'll be able to use the serial monitor for checking code as it goes and it'll be much simpler to upload fixes to the code if needed.

my GUI is still a work in progress, want to get a bit of an 80s digidash sort of vibe going on. 

  • Like 5
Link to comment
Share on other sites

This screen has so far been one of the most infuriating fucken things I've done in a long time hahaha.

Shitty things about it:

1. In the example programs it has the baud rate set to 200,000 yet it doesnt want to communicate at anything above 9600.
Yes, that took fucken ages to figure out.

2. To update the code on the screen, you need to take out the micro SD from the back, put that into an SD card embigginer and plug it into the laptop. Then undo the fucking RIBBON CABLE to the screen and plug it into the USB adaptor to communicate to PC instead.

Then compile the program, put SD card back in, and swap the worlds fiddliest god damn ribbon cable back over.
 
To just fuck you off that little bit more, you cant upload any arduino code while the shield is on either.
You have to take it off every time.

When your code isnt writing to the screen for reasons unknown you can imagine how cumbersome this process gets. God damn I was ready to take a sledge hammer to this bloody thing today.

Ocean swim calmed me down and I came back and figured out baud rate seems to be the issue after a few more hours of fucking around.

It's one of the most user unfriendly processes I have experienced in a long time, i hope the end result will be worth all the swear words!

  • Like 2
Link to comment
Share on other sites

If you want/need a hand, gimme a yell. Happy to sit down for an evening and have a play :)

Also, me and Cam will have a (hopefully) regular project night again each week, and you're welcome to join as this is the sorta projects we'd be working on (fun electronicy/automotivy projects)

  • Like 2
Link to comment
Share on other sites

Thanks Ned that sounds fun.

With some more persistence and masochism I got the bloody thing working last night though! So happy about that. Got the baud rate working at 200,000 as well.

Hopefully this weekend or next week I'll have it working for its intended task. 

The refresh rate on the screen is great once it's going.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Woops have been lazy. 

But did a bit more on this today. Had some garbage  values coming through so thought I'd better have a single place to check them all:

vvi2v2xq.0yw.jpg

Found a few problems in the code or arrangement of canbus frames and now most things are working.

So now I can try make some more useful screens and know the values are as expected.

Still need to get all of the pots working but my soldering sucks on things that small and fiddly. Bah.

But you can see when each of the values updates and the refresh rate is reasonable, that's with canbus running at 500kbps, can go up to 1000kbps so might try that too. But it might not be the canbus itself that is the bottleneck to values refreshing. My code can definitely be optimized a bit by putting more of the tasks into the "if" structures I have in place but for starters its been good to just group all of the commands together and run them all through each loop, just for sake of easy troubleshooting. (Like when you copy pasted a piece of code 20 times and forgot the ; each time)

  • Like 5
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...