Voriger Thread
Nächster Thread
Drucke Thread
Rate Thread
Seite 1 von 3 1 2 3
#650826 11/05/2017 20:50
Joined: Jun 2016
Posts: 50
on the road
OP Offline
on the road
Joined: Jun 2016
Posts: 50
I have developed a replacement for the AFAM computer using an Arduino Due. Now you can control your Diff locks how you want to!

http://www.tuckstruck.net/truck-and-kit/modifications-and-repairs/afam-computer-replacement/

Zuletzt bearbeitet von Marcus Tuck; 11/05/2017 20:50.
::::: Werbung ::::: TR
Joined: Jan 2009
Posts: 667
Likes: 14
Nobelhobel
Offline
Nobelhobel
Joined: Jan 2009
Posts: 667
Likes: 14
Hi Marcus

Double wow! How are you doing?

First wow ist for the completion of this rather engaging project, for the reverse engineering of the AFAM and for the electronics design! And, knowing you, I assume it's all working like a charm.
Second wow is that you find the time and stamina to tackle such a complex task during your trip. Great!

I'm also amazed you managed to write the controller logic in less than 500 lines. The only thing that worries me here, if I may say so, is the monolithic structure of the actual control loop with lots of delay statements. How do you software-test this? Close to impossible, I would argue. If you're up for some refactoring I'd suggest you first draw a state-event diagram for your logic to abstract from individual state variables, then implement that. Here's an example (PDF) from my Arduino boiler controller (the rest of the code is there, too).

But despite my criticism, your work is awe-inspiring. Once more. Well done, mate!

Happy travelling
--
oliver

Joined: Jun 2016
Posts: 50
on the road
OP Offline
on the road
Joined: Jun 2016
Posts: 50
Hi Oliver,

You introduced me to the Arduino back in Brazil so it's all your fault ;-)

I just wrote the code by thinking through all the logical steps I needed, as you know I'm not a software engineer! During the development I had the serial port enabled and streamed data to my laptop. This allowed me to see what was going on in real time (I removed this code for the in use software version). I also set up a counter so I could see how quickly the 'software loop' was running. The two things that slow down the loop are the rpm and vehicle speed calculations. If the engine is not running and/or you are not moving the calculations for the rpm and speed wait until the 'time out' I have set, this is a long delay. Even with this delay and 'printing' all the data to the serial port the software was looping 4 times per second which I think is more than quick enough for this application (if you are moving the loop will be even faster).

The software only uses 5% of the memory and I have already developed an artificial horizon using the 9 axis shield and is displayed on a 1.77" TFT screen. It will warn you if you approach your 'roll angle' and can turn on the buzzer or check light to get your attention! The website update is on its way, I just need to build a booster for the signal going to the display as the Arduino is mounted under the drivers seat and the cable runs are a little long. I have also used an Uno to simulate my speed sensor when I had a fault with it, again it will be posted up a few weeks.

[Linked Image von i67.tinypic.com]

I will try and learn the proper software engineer way of doing things for the next project!

All the best, form a very wet and raining Suriname


Joined: Jan 2009
Posts: 667
Likes: 14
Nobelhobel
Offline
Nobelhobel
Joined: Jan 2009
Posts: 667
Likes: 14
Hey Marcus
Original geschrieben von Marcus Tuck
You introduced me to the Arduino back in Brazil so it's all your fault ;-)
I'll happily admit to that!

Original geschrieben von Marcus Tuck
I just wrote the code by thinking through all the logical steps I needed, as you know I'm not a software engineer!
…
I will try and learn the proper software engineer way of doing things for the next project!
No worries! As I wrote, you did amazingly well. In general, C++ is not an easy environment to get into, but on one hand Arduino makes it as easy as possible and on the other hand does not foster or encourage good software design practises. And since your work will hopefully inspire more people to do similar projects, I thought I'll drop in a hint towards a more robust software structure and design process. As part of my own work I developed a small framework to ease the development of these kinds of controllers. I.e. to facilitate the use of logging to the processor's flash memory, to read and write configuration parameters (also on flash memory) and to base the controller's main loop on an easy-to-understand state-event automaton (github). What's still missing in that framework are stand-alone examples that make it easy to understand how the elements of the framework can easily be taken advantage of (the current examples folder contains the modules I use to software-test my own code). I'll deliver those in the near future.

Wishing you lots of sunshine, clear roads, happy people and no bugs (I actually mean the ones that fly but realise you wouldn't want any in your projects either ;-)
--
oliver

Joined: May 2015
Posts: 610
Likes: 7
R
Suchtiger
Offline
Suchtiger
R
Joined: May 2015
Posts: 610
Likes: 7
Hi Marcus,

good stuff, congratulations.

What is the main reason for the need of a "computer" / PLC? Couldn't the diff lock control be done with some simple switches and feedback LEDs or indicators?

Regards
Raphael


Fuel-to-Noise-Converter (F2NC) Iveco TurboDaily 4x4 40-10 WC, FGst-Nr. ...5939317
Joined: Jun 2016
Posts: 50
on the road
OP Offline
on the road
Joined: Jun 2016
Posts: 50
Hi Raphael,

Yes it could be done with a few switches and relays but you would loose the safety features of the speed limits. But it was also to give me something to play with in my spare time.

Hi Oliver,

Things are progressing and I will look to better structuring. I have now got the 9 Axis motion sensor working (needed to change some of the Bosch library to get it to work with the Due for some reason). I have built a signal booster which also matches the signal levels between the Uno (5V) and Due (3.3V) so they can communicate over a long serial link. I have the 9 axis data streaming to the Uno from the Due but some more research/learning is required on my part before I crack this data link completely. The idea is the Due is mounted solidly below my seat doing the AFAM and gyro and the Uno will have the display and possibly some buttons. I plan to add extra functionality like the Horizon and other ideas I have in the pipeline. Running the 9 Axis sensor and the AFAM functions the Due is still clocking through the main loop 3 times a second, which is more than enough.


Joined: Jun 2016
Posts: 50
on the road
OP Offline
on the road
Joined: Jun 2016
Posts: 50
I have now re-written most of the code, using routines and generally cleaning things up. It works well, tested in the Suriname jungle! There is also a mode to engage only the rear lock. All updated on the website at the original link above.

Joined: May 2005
Posts: 7,636
Likes: 133
Daily96 40.10W
Offline
Daily96 40.10W
Joined: May 2005
Posts: 7,636
Likes: 133
Hi Marcus,

witch fault code reader do you use ? Apparently it works quite well with the IVECO engine ECU

(Sorry for OT)


Regards

Juergen




Gruß Juergen

Joined: Jun 2016
Posts: 50
on the road
OP Offline
on the road
Joined: Jun 2016
Posts: 50
Hi Juergen,

I use an EASY and a PicoScope. However, the EASY is no help for the AFAM as there is no computer, it is just hard wired logic circuits. I am working on a PCB that will be a direct replacement for the AFAM circuit board. More to follow in a few months.

Regards,

Marcus

Joined: May 2005
Posts: 7,636
Likes: 133
Daily96 40.10W
Offline
Daily96 40.10W
Joined: May 2005
Posts: 7,636
Likes: 133
as I wrote it`s OT - I really meant the engine ecu, not the AFAM.

So the screenshots on your website are made with EASY, i.e. this one from here on your site .

[Linked Image von tuckstruck.net]

That`s a nice visualisation what happens and how the ecu works.


Gruß Juergen

Seite 1 von 3 1 2 3

Link Copied to Clipboard
Forum Search
Member Spotlight
Allradchrist
Allradchrist
Österreich
Posts: 509
Joined: May 2002
::: VIERMALVIER.DE::: Werbung ro
Aktivste Themen(Ansichten)
20,250,158 Hertha`s Pinte
7,981,292 Pier 18
3,764,320 Auf`m Keller
3,696,945 Musik-Empfehlungen
2,731,312 Neue Kfz-Steuer
2,684,145 Alte Möhren ...
Wer ist online
2 members (Gas69, 1 unsichtbar), 251 guests, and 0 robots.
Key: Admin, Global Mod, Mod
::WERBUNG:: Klick to sponsor VMV
Top Likes Received (30 Days)
DaPo 3
kattho 2
GSM 1
Heutige Geburtstage
Mickey 65C15, Oachkatzl
Neueste Mitglieder
RHH Kawon, lichtmaschine, Jendrzej, David25, Eljott23
10,098 Registrierte Benutzer
Top Schreiber
DaPo 26,633
Ozymandias 16,741
Yankee 16,494
ranx 16,049
RoverLover 15,075
:::: VIERMALVIER.DE:::: WERBUNG
Foren Statistiken
Foren37
Themen44,384
Posts675,497
Mitglieder10,098
Most Online1,525
Sep 24th, 2025
Powered by UBB.threads™ PHP Forum Software 7.7.5