User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 7:39 am

Presently, we have been using, and gotten a lot of "mileage"
out of the AVR-CAN board, which supports one CAN bus,
digital and some analog I/O, and a serial port.

However, as a 16 Mhz 8-bit uP, it is not the fastest kid
on the block. The whole Arduino lineup is nicely
supported, has many enthusiasts, but was also
a bit under-powered. Until recently...

The Arduino Due, with the form factor of the Arduino Mega 2560,
sports 84 Mhz and a 32 bit uP, with more I/O, 2 USB, 2 CAN, etc.
Downside, the libraries to support it are... evolving. The porting
of Sketches from the old Arduino architecture to the new Due
architecture seems to impact almost anything except blinking
one LED. Many of the new complexities are hidden by
new function Libraries, written or evolved to support the Due.

So, if you want to help us go down this path of discovery,
joining the "Arduino Due Forum", getting a Due from
one of the many sources, obtain a USB A to micro-B cable,
and download the IDE (Interactive Development Environment)
from Arduino (search Arduino Due Software Development),
version 1.5.4r2 (1.5.x is still a "Beta" version). The zip file is about
150 MB, and it unzips into a folder of about 350 MB. No need to
install, I just moved the folder (Arduino-1.5.3) to the root of
my D-drive, using Vista (but it should work on XP upward, I think).

So, relatively easy to "play", if you desire.
Post below if you are unterested.
Thanks, Gary
Last edited by garygid on Tue Nov 05, 2013 11:25 am, edited 1 time in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 7:42 am

Getting Started Info:

Ordering an Arduino Due R3:

Sparkfun, Pololu, Amazon, eBay, and others carry the Arduino Due.
There are even clones, but the Due R3 is the latest genuine
board, as of 1 Sept 2013, and is typically found for about $50.

Some links:
http://www.mouser.com/ProductDetail/Ard ... UqiduMw%3d" onclick="window.open(this.href);return false;
https://www.sparkfun.com/products/11589" onclick="window.open(this.href);return false; (lots in stock)
http://www.iorodeo.com/content/arduino-due-r3" onclick="window.open(this.href);return false;
http://www.amazon.com/Arduino-A000062-Due/dp/B00A6C3JN2" onclick="window.open(this.href);return false;

Ordering a USB cable for Programming the Due

A USB-A to micro-B cable is necessary for first use of the Due.
It powers the Due, allows the IDE to conveniently flash
the Due, and allows statements like Serial.print("Hello World") to show
text in the Serial Monitor window, which is a Tool included in the IDE.

Available from many places, and commonly found to charge phones and tablets.
Although local sources might be faster, or you might already have this
USB "micro" cable, it is not included with the Arduino Due.

links:
http://deepsurplus.com/Computer-Cables- ... o-B-Male_2" onclick="window.open(this.href);return false;

Ordering a Prototype Shield for the Due

Not necessary, but might be convenient if you need to add some circuitry
or connections (we do). I just ordered from NKC.

NOTE: If the shield is not the top shield, it should extended the 2x3 SPI connector
in the middle of the proto area. Somewhat inconveniently, this requires a long-pin
2x3 female header mounted upside down (the pin side up)!

links:
http://store.nkcelectronics.com/MEGAshi ... p_309.html" onclick="window.open(this.href);return false; (for Due, FL. 33326, I bought these.)

other links:
https://www.sparkfun.com/products/9346" onclick="window.open(this.href);return false; (for Mega 2560, and not the best)
http://www.adafruit.com/products/192?gc ... 4AodO3QAlA" onclick="window.open(this.href);return false; (for Due, much better)
http://togglebit.net/2013/06/11/protoca ... r-the-due/" onclick="window.open(this.href);return false; (layout for two CAN ports)

A color TFT display, with Touch input, and a Display Shield:

I bought several display sizes from ColdTears Electronics, and their
display shield for the Due. All of these are with the "font chip".

The 5" (800x480) and the High-Resolution version of the 3.2" (480x320)
are best supported at the present time. However, as of
October 2013, I have added support for the 3.5" (480x320)
touch display, and the 4" and 7" displays (both 800x480).

So, all five sizes are candidates, depending upon
the requirements of the application.
I am using the CTE50 and CTE32HR for now, attempting
to make a controller and logger for the mini-QC device.
However, my software runs on all five sizes.

CTE32HR (480x320) for $30:
http://www.ebay.com/itm/3-2-inch-480x32 ... 1c31fbdbca" onclick="window.open(this.href);return false;

Display Shield for Arduino Due for $13:
http://www.ebay.com/itm/TFT-SD-Shield-f ... 1057447668" onclick="window.open(this.href);return false;?

Yes, shipping take quite a while.

Getting the IDE from Arduino:

Download the latest version 1.5.? "Beta" Zip file (about 150 MB), free, from:
http://arduino.cc/en/main/software" onclick="window.open(this.href);return false;

You don't need the installer. The UnZip process will create a folder
with around 1700 files, about 350 MB in size, typically named
the "arduino-1.5.4" folder for this latest version.

This folder can be moved almost anywhere, but I usually put it at the
root of my D (or C, if there is no D) drive, primarily to minimize the
length of the path names. Others have "buried" the folder and
have had problems.

The arduino.exe file is easily found insde. Just double-click to run it.

Running your first Due Sketch

After starting the arduino.exe program, select Board in the Tools menu,
and select the "Arduino Due (Programming Port)". After you get an actual
Due board, you will also select a Serial Port. For now, without the board,
the best we can do is to select examples, or write new Sketches, and
see if they compile.

There is lots of good information and help at the
Arduino Due Forum
http://forum.arduino.cc/index.php?board=87.0" onclick="window.open(this.href);return false;
Last edited by garygid on Tue Nov 05, 2013 11:42 am, edited 15 times in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 7:45 am

Usage Hints

Programming USB Port
Just connect the Programming USB Port to the PC, and
note which Comm Port number is assigned by the PC
after the driver installation.

Important hint:
The driver is found by browsing to the ...
/arduino-1.5.4/drivers/
folder.

I usually set the PC to use Comm Port 30 for
this special Programming Port.

Programming
Start with the Example Sketches (programs for Arduino)
that are included, and then try some of those that are
typically included with each library.

Note, not all the examples work on the Due.

Serial Monitor Tool
If the Sketch uses the convenient Serial functions, like
Serial.print("Hello World") ;
you can typically see that output using the IDE's
Serial Monitor window, which helps with debugging.

Native USB Port
This USB port is supported with firmware and circuitry
in the Due itself, and I use it to send Logging Data
to my CAN-Do program in the PC.

When connected to the PC, with the Due running,
this usually creates a Virtual Comm Port in the PC.
I typically set my PC to "create" Comm Port 10.

To do some debugging, you might use some
Dumb Terminal Program, but it is unusual for
one to work well with binary data instead of
the standard ASCII characters.

Use with CAN-Do:
Get my CAN-Do program (for Windows) and some log files at:
www. wwwsite. com/puzzles/cando/
Last edited by garygid on Tue Nov 05, 2013 12:00 pm, edited 2 times in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 7:47 am

Working Sketches

Examples, as supplied in the IDE

Basic Blink - works with 1.5.3

Constructed Stand-Alone Sketches

Sketches that requires Library Mods

---------
There is lots of goof information and help at the
Arduino Due Forum
http://forum.arduino.cc/index.php?board=87.0" onclick="window.open(this.href);return false;
Last edited by garygid on Wed Sep 11, 2013 8:24 am, edited 1 time in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 7:59 am

Summary of Hardware and Software:
(as used for my mini-QC project Sketches)

(If anybody needs additional links, I will add them
to the thread's 2nd post, above.)

Hardwre:
1. Arduino Due R3, unmodified
2. Proto-board shield for the Due (not yet required)
3. ColdTears Electronics (CTE) display Shield for Due (not Mega)
4. A CTE touch-display (with font chip), see list below.
5. USB cable, A to micro B to fit the Due's Programming port.
6. Host computer (l use a Windows PC) to run the Arduino IDE
(Interactive Development Environment).
7. Host hardware to run my Windows CAN-Do program (NYR).
8. Another USB cable, like above, if programming and
using CAN-Do "at the same time", primarily to avoid
a lot of plugging and unplugging to the Due.

Software:
1. The latest IDE for the Due (now, 1.5.4r2) from Arduino
2. Three added Libraries, modified by me (UTFT, UTFT_CTE, and UTouch)
3. Other non-included Libraries (DueTC)
4. My Script for Mini-QC simulation (v35 is the current version)
5. My CAN-Do program, not required, for capturing and seeing log data.

Touch Display Boards:
CTE32HR or CTE35 are the most likely candidates,
because of their lower cost. Both are 480X320.
I have also used the larger 4", 5", and 7" displays, all 800x480.

At this point (v29), my Script seems to support all 5 of these
displays, by changing one line of the source code to specify
the display device, CTE32HR, CTE35, CTE40, CTE50, and CTE70.

CAUTION : This hardware and software is not yet suitable
or safe to use for controlling any real-time critical process, like
a power supply used as a charger for car batteries.

But, if you are interested in joining the project, welcome aboard.
Cheers, Gary
Last edited by garygid on Tue Nov 05, 2013 12:09 pm, edited 2 times in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 8:00 am

Miscellaneous
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 8:00 am

Other Progress
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 8:01 am

Sketches for Mini-QC functions

If you have, or have ordered, the necessary hardware,
you may PM me with your circumstances and email
address.

Or, email me (with "Mini-QC Sketch for Due" in the
Subject line, and request the Software.

Soon, I will add the latest software to my website,
use the link in my signature.
Last edited by garygid on Tue Nov 05, 2013 12:16 pm, edited 1 time in total.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

User avatar
FalconFour
Posts: 324
Joined: Wed Sep 19, 2012 12:07 pm
Delivery Date: 14 Sep 2012
Leaf Number: 008681
Location: San Jose, CA
Contact: Website Facebook

Re: Using an Arduino Due as a mini-QC controller

Sun Sep 01, 2013 6:43 pm

Interested indeed. :3 I've ported a few AVR-family programs to run on my Arduino, and a lot of the language is very flexible with just minor syntax changes from what I'd seen between models so far. I'd love to take a whack at this, but I first need to get my hands on one. I'll be on the back burner 'til I can find the opportunity to acquire one, but it sure sounds promising :D

edit:
"... based on the... ARM..."

Awh hell. They had to go and make everything complicated now, didn't they? *throws all the AVR assembly language off the desk* Bah! :lol:
100% gas-free since September 2012
2011 LEAF SL - Sep 2012~Sep 2014 - 35,737 miles
2013 LEAF S+Charge - Jan 2014-Feb 2017 - 68,065 miles
2014 LEAF SV+Premium+QC - Feb 2017-present

User avatar
garygid
Gold Member
Posts: 12469
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using an Arduino Due as a mini-QC controller

Mon Sep 02, 2013 8:19 am

See the Ordering info in the second post.
See SOC/GID-Meter and CAN-Do Info
2010 Prius
2011 LEAF, 2014 Tesla S85
2018 & 2019 Tesla Model 3
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
Craigslist: Xm5000Li Electric Motorcycle

Return to “LEAF CANBus”