BC Wiki - Arduino Hacking

Category: diy


The Arduino does an excellent job of abstracting away the implementation details of a microcontroller and allowing the user to think about it as a collection of easy-to-use high-level functions.

(Here are some minor changes to test the jekyll-feed plugin!)

(here are some additional changes!)

(and some more!)

Compile and Upload from the CLI

You can upload code to an Arduino using the command-line interface:

`arduino –upload –port /dev/arduino –board arduino:avr:uno filename.ino

Programmatic Resets

Lots of discussion in the Disabling AutoReset on Serial Connection page on the Arduino site.

Disable hangup-on-close in Linux: stty -F /dev/arduino-uno -hupcl

After setting this, reading the data printed over the serial device will not cause the Arduino to reset: cat /dev/arduino-uno

To make it reset-on-connection again, just run: stty -F /dev/arduino-uno hupcl

Now that you know what controls the Arduino reset, you can even reset it yourself from Python:

>>> import serial
>>> from time import sleep
>>> arduino = serial.Serial('/dev/arduino_uno',bytesize=serial.EIGHTBITS,
...                      parity=serial.PARITY_NONE,
...                      stopbits=serial.STOPBITS_ONE,
...                      timeout=1,
...                      xonxoff=0,
...                      rtscts=0
...                      )
>>> arduino.setDTR(False); sleep(1); arduino.flushInput(); arduino.setDTR(True)

More notes on these ideas:

Wait on Arduino auto-reset using pySerial
https://stackoverflow.com/questions/21073086/wait-on-arduino-auto-reset-using-pyserial

Reset Arduino from Python!

Linux: serial port, Arduino reset, avrdude
http://forum.arduino.cc/index.php?topic=39468.0

DisablingAutoResetOnSerialConnection
http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection


http://www.codeproject.com/Articles/1012319/Arduino-Software-Reset
http://www.theengineeringprojects.com/2015/11/reset-arduino-programmatically.html
http://www.xappsoftware.com/wordpress/2013/06/24/three-ways-to-reset-an-arduino-board-by-code/
https://arduino.stackexchange.com/questions/1477/reset-an-arduino-uno-by-an-command-software
Reset command
http://forum.arduino.cc/index.php?topic=12874.0

http://playground.arduino.cc/Main/ArduinoReset

http://www.instructables.com/id/two-ways-to-reset-arduino-in-software/

Procurement

Arduino Uno - R3 https://www.sparkfun.com/products/11021 $24.95

Arduino Uno - R3 SMD https://www.sparkfun.com/products/11224 $29.95

IEIK UNO R3 Board ATmega328P with USB Cable for Arduino http://www.amazon.com/gp/product/B00P2FX9WY/ $10.49

Arduino Compatible Uno R3 Rev3 Development Board https://www.fasttech.com/product/1001700-arduino-compatible-uno-r3-rev3-development-board $7.24

Arduino UNO R3 development board microcontroller /w USB cable 328P DCCduino http://www.newegg.com/Product/Product.aspx?Item=9SIA7BF2K19064 $11.96

Arduino Interrupts

Arduino-Compatible Hardware

LED Displays

5V MAX7219 8-Digit Red LED Display Module 7 Segment Digital Tube For Arduino MCU http://www.amazon.com/dp/B00IHQ7STK/

Adafruit 0.56” 4-digit 7-segment Display W/i2c Backpack - Green http://www.amazon.com/dp/B00GJRQUTS/

Anycubic MAX7219 CWG 8-Digit Digital Display Control Module 8-Digit 7 Segment Digital LED Display Tube for Arduino http://www.amazon.com/dp/B014P8S3PG

Arduino Software IDE

Build From Source for Ubuntu

sudo apt-get install git make gcc ant openjdk-8-jdk
git clone git://github.com/arduino/Arduino.git
cd /path/to/arduino/build
ant dist
ant run
sudo mkdir /opt/arduino
sudo chown brandon: /opt/arduino
cp linux/arduino-1.6.10-linux64.tar.xz /opt/arduino/
cd /opt/arduino/
tar xvJf arduino-1.6.10-linux64.tar.xz
cd arduino-1.6.10/
./install.sh

# to update later:
cd /path/to/arduino
git pull
ant clean build start

Packing for Debian/Ubuntu

Looks like licensing issues are keeping the newer Arduino IDEs from making it into the Debian/Ubuntu repos.

From: Scott Howard <showard314@gmail.com>
To: 780706@bugs.debian.org
Subject: Update re: arduino 1.6+
Date: Fri, 8 Apr 2016 17:18:08 -0400

[Message part 1 (text/plain, inline)]

The update is there is no update. The Debian git repository is still ready
to go,. I don't have time to work on it that much at the moment (either on
following up with licensing or packaging), so if anyone is interested in
helping out in any way (including co-maintaining or adopting the package),
please let me know.
~Scott

Scott Howard looks like a really cool person:

Here are some Debian build instructions that are current as of 1.6.7: https://bugs.launchpad.net/ubuntu/+source/arduino/+bug/1425677/comments/10

“There are a few problems with getting this packaged as v1.6.6 requires Java 8. I almost got a complete build of the package with arduino-1.6.5-r3 from arduino.cc and Scott Howard’s debian/ folder from his repository. Anything later than that version requires Java 8. I’m still using Trusty and won’t be upgrading from that until the next LTS is released.”

Looks like there is some older Arduino source here, and it contains a debian folder with build instructions: http://anonscm.debian.org/cgit/collab-maint/arduino.git

This repo DOES build successfully in Ubuntu 16.04; though it’s labeled ‘1.5’ or ‘1.6’ in the repo, it generates a Debian installer version 1.0.5.

References related to the version numbering:

AVR Programming

Procurement:

Setting up development tools:

Get Involved

Arduino community fora:

Variants and Alternatives

STMduino

https://en.wikipedia.org/wiki/STM32
"STM32 is a family of 32-bit microcontroller integrated circuits by STMicroelectronics."

http://www.stm32duino.com/
https://github.com/rogerclarkmelbourne/Arduino_STM32
http://arduino-for-beginners.blogspot.com/search/label/STM32duino
http://www.rogerclark.net/arduino-stm32-usb-serial-and-dfu/
https://c9.io/serasidis/stm32duino
http://www.jyetech.com/forum/viewtopic.php?f=18&t=658
http://analoglamb.com/shop/stm32duino
http://www.davidpilling.net/wiki/index.php/STM32
http://xtl.kapsi.fi/blog.2015-07-14.STM32duino_setup.html