Jekyll2019-02-09T20:15:49-08:00https://pollend.github.io//feed.xmlMichael PollindMichael Pollind
Google Code-In Trip2019-02-09T20:06:00-08:002019-02-09T20:06:00-08:00https://pollend.github.io//2019/02/09/gci-trip<p>Google was very accommodating for the GCI and overall I thought it was a really great experience. We had the chance to listen to various googlers speak about their work and what they’ve been working on. This includes: project FI, Waymo, chrome books, and open source copyright. The talks we’re spaced out on the second and final day of the trip. I had the chance to interact with other open source organizations: Ubuntu and Apertium.</p>
<p>The second day of the trip was a tour of the Google main campus. <a href="https://forum.terasology.org/members/eviltak.1940/">@eviltak</a> and <a href="https://forum.terasology.org/members/theghostinthemachine.2270/">@TheGhostInTheMachine</a> were provided trophies along with all the other students on the trip. Google provided lunch from their cafeteria along with dinner and breakfast in the main lobby area. Afterwards everyone had the chance to buy from the google store with 75$ of credit. This region of the campus also had an area dedicated for the various versions of android and a community center showing off early Google.</p>
<p>For the fun day, there are two options. you can either ride on the segway or the tram car tour of san franscisco. <a href="https://forum.terasology.org/members/eviltak.1940/">@eviltak</a> and <a href="https://forum.terasology.org/members/theghostinthemachine.2270/">@TheGhostInTheMachine</a> rode on the tram while I went on the Segay tour. the Segway tour starts with an introduction, safety and basic practice. The rest of the trip mainly went through Fisherman Warf. The stops include: Saints Peter and Paul Church, Coit tower, through the boardwalk, ghirardelli square, the pier and back to the start. Afterwards Google provided lunch at a local bar and a bus ride to the Golden Gate Bridge. I had a chance to walk across the entire bridge and back. Afterwards the bus drove everyone to nearby pier and the trip concluded with dinner on a yacht through the bay.</p>
<p>I had a chance to meet up with both <a href="https://forum.terasology.org/members/eviltak.1940/">@eviltak</a> and <a href="https://forum.terasology.org/members/theghostinthemachine.2270/">@TheGhostInTheMachine</a> and talk with them over the trip. I had a chance to talk about what I’ve been working on in regards to GCI and personal research and learn about their background.</p>
<p><img src="https://lh3.googleusercontent.com/9_F-VHxQuG5XXiPww__3nvx3GYvUgVH70bRwFYnrUvvgZ53m0eqKiWsNlBYCggGemWwaQrfX8EZYm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okYRcBe_0ZCjS2dvkl6DtS922bWlYk9hHuC3zBOpBBoQNFo33oAuoXW1kZysIuRFd2rHWhoi98FSIIn3qIvqG83XaK4ACsLf1ZNQMfluMoWDUqwYQX0lqoAZt_XRUB7JaYljvqjV3VFjwRF1-ey2clBk1yAoWJg0jPP-alkD71CBKwzhrgv8msx4lBvqk80qGm3-vbq8uSvuBVpPMUo9q7_F4_8WvKDht22_9864u7bg=w1243-h829-no" alt="" /></p>Google was very accommodating for the GCI and overall I thought it was a really great experience. We had the chance to listen to various googlers speak about their work and what they’ve been working on. This includes: project FI, Waymo, chrome books, and open source copyright. The talks we’re spaced out on the second and final day of the trip. I had the chance to interact with other open source organizations: Ubuntu and Apertium.Ardunio, Avr and Scons2019-01-29T19:14:00-08:002019-01-29T19:14:00-08:00https://pollend.github.io//2019/01/29/ardunio-avr-scons<p>The Arduino IDE is a really good starting environment but I was looking for something a bit more flexible.
Atmel studio is built for AVR chips but the environment obscures a lot of the process and adding an Ardunio library prevents the IDE
from properly building the binary and working out how to fix the build was just too much of a hassle. This configuration allows the use of other
environments besides the Ardunio IDE such as <a href="https://code.visualstudio.com/">Vscode</a> and <a href="https://www.jetbrains.com/clion/">Clion</a>.
Scons is a build system centered around python and can be easily configured to produce the correct binaries for AVR using avr-gcc, avr-g++, and avr-objcopy. The basic process is
to compile the source using the avr-g++, avr-gcc and then converting the compiled object files to ihex.
The build process can also produce the necessary .hex files that can be flashed with <a href="https://www.microchip.com/mplab/mplab-integrated-programming-environment">Mplab IPE</a> or avrdude.</p>
<p>The scons build is split up into two sections. setting up the AVR environment and then building the final hex file. Any additional libraries are just submodules in the 3rdparty folder. this first part sets up the environment along with the correct build configurations such as the avr compiler and the processor that this source will compile to. <code>Device</code> is set to whatever the associated device that will be compiled for. <code>CPU_FREQUENCY</code> will define the frequency that the processor is configured for. The actual frequency is defined by the fuse bits that will have to be set.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>env = Environment()
# Set environment for AVR-GCC.
env['CC'] = 'avr-gcc'
env['CXX'] = 'avr-g++'
env['AS'] = 'avr-gcc'
env['CPPPATH'] = ['/usr/avr/include/', 'build']
env['OBJCOPY'] = 'avr-objcopy'
env['SIZE'] = 'avr-size'
env.Append(CCFLAGS = '-Os -Wall -Werror -flto')
# Declare some variables about microcontroller.
# Microcontroller type.
DEVICE = 'atmega328'
# Microcontroller frequency.
CPU_FREQUENCY = '8000000UL' # Hz
# Set environment for an Atmel AVR Atmega 328p microcontroller.
# Create and initialize the environment.
env.Append(CCFLAGS = '-mmcu=' + DEVICE)
env.Append(LINKFLAGS = '-mmcu=' + DEVICE)
env.Append(LINKFLAGS = '-Wl,-u,vfprintf -lprintf_min')
env.Append(LINKFLAGS = '-lm')
env.Append(CPPDEFINES = 'F_CPU=' + CPU_FREQUENCY)
</code></pre></div></div>
<p>The second section after this is just compiling the necessary code. In this case I’m using Minicore along with the Wire library and SD card library. the basic process is just to include all the necessary source files and defined the correct header locations. I could of separated Minicore into a static library along with the other libraries and link that separately but the compile times are so quick that it’s not really necessary. its fairly easy to include other submodules and modify the build with other libraries.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> Define target name.
TARGET = 'build/main'
# Define source file.
env.Append(CPPPATH=[
'src',
'3rdparty/MiniCore/avr/cores/MCUdude_corefiles/',
'3rdparty/MiniCore/avr/libraries/Wire/src/',
'3rdparty/MiniCore/avr/libraries/SPI/src/',
'3rdparty/SD/src/',
'3rdparty/MiniCore/avr/variants/standard'])
wiring_pulse = env.Object(
target = '3rdparty/MiniCore/avr/cores/MCUdude_corefiles/wiring_pulse_1.o',
source = '3rdparty/MiniCore/avr/cores/MCUdude_corefiles/wiring_pulse.S')
sources = [
Glob('./main.cpp'),
Glob("3rdparty/MiniCore/avr/cores/MCUdude_corefiles/*.cpp"),
Glob("3rdparty/MiniCore/avr/cores/MCUdude_corefiles/*.c"),
Glob("3rdparty/MiniCore/avr/libraries/Wire/src/*/*.c"),
Glob("3rdparty/MiniCore/avr/libraries/Wire/src/*.cpp"),
Glob("3rdparty/MiniCore/avr/libraries/SPI/src/*.cpp"),
Glob("3rdparty/SD/src/*/*.cpp"),
Glob("3rdparty/SD/src/*.cpp"),
wiring_pulse]
# Build the program.
# Default() is used so that when running scons only sources are
# compiled and linked- no other commands (see below) are run
Default(env.Program(target = TARGET + '.elf', source = sources))
# Create hex binary file.
Default(env.Command(TARGET + '.hex', TARGET + '.elf', env['OBJCOPY'] + ' -O ihex $SOURCE $TARGET'))
# Compute memory usage.
Default(env.Command(None, TARGET + '.elf', env['SIZE'] + ' -C --mcu=' + DEVICE + ' $SOURCE'))
Default(env.Command(None, None, 'ctags -R -f src/.tags src'))
</code></pre></div></div>
<h2 id="build-template-source">Build Template: <a href="https://github.com/GaitRehabilitation/avr_ardunio_template">source</a></h2>The Arduino IDE is a really good starting environment but I was looking for something a bit more flexible. Atmel studio is built for AVR chips but the environment obscures a lot of the process and adding an Ardunio library prevents the IDE from properly building the binary and working out how to fix the build was just too much of a hassle. This configuration allows the use of other environments besides the Ardunio IDE such as Vscode and Clion. Scons is a build system centered around python and can be easily configured to produce the correct binaries for AVR using avr-gcc, avr-g++, and avr-objcopy. The basic process is to compile the source using the avr-g++, avr-gcc and then converting the compiled object files to ihex. The build process can also produce the necessary .hex files that can be flashed with Mplab IPE or avrdude.Micro Logger V1.0 (ICM-20498)2018-11-18T23:04:00-08:002018-11-18T23:04:00-08:00https://pollend.github.io//2018/11/18/micro-logger-v1-0-icm-20498<h2 id="introduction">Introduction</h2>
<p>The Micro Logger is a small wearable sensor that logs gyro and acceleration data directly to an SD card. This first design was kept very simple and the footprint was minimized down as much as possible. Going forward, there are some basic plans to replace the sd card with an e.mmc module and solder the connections of the battery directly to the board with a charging IC. This should make it possible to charge battery through a micro-usb interface. Variations of this in the future can explore different mem sensors and compare characteristic performance.</p>
<h2 id="hardware">Hardware</h2>
<p><img src="https://sites.chapman.edu/soangra/files/2018/11/Screenshot_20181117_002654-12glz3o.png" alt="Micro Logger" height="auto" width="20%" /></p>
<p>This implementation of the sensor uses an <a href="https://www.invensense.com/products/motion-tracking/9-axis/icm-20948">ICM-20498</a> and a i2c bridge(<a href="http://www.ti.com/lit/ds/symlink/pca9306.pdf">PCA9306DCUR</a>). Due to the lower running voltage of the mems sensor a separate drop out is used to bring the voltage down to 1.8v vs the 3.3v that is running the micro processor. The signals from the mems sensor are passed through an <a href="https://www.mouser.com/ProductDetail/Microchip-Technology-Atmel/ATMEGA328-AU?qs=sGAEpiMZZMvqv2n3s2xjse40PngS4U1x0lh%252bvvDKKQk%3d">ATMEGA-328-AU</a> running <a href="https://github.com/MCUdude/MicroCore">MicroCore</a> before being saved to an SD card. The 2x3 header on the board is an ISP programming header for flashing the processor. A board level schematic can be found here: <a href="https://sites.chapman.edu/soangra/files/2018/10/micro_logger-287fha3.pdf">Schematic</a></p>
<p>Some tweaks to the design include changing the the resistors on the i2c line and testing if it’s possible to increase the frequency. The ATMEGA328-AU is already fairly small but Microchip also sell a variation of the same processor in a flat-package variant; This could help with minimizing the size of the board.</p>
<hr />
<h2 id="software">Software</h2>
<p><img src="https://lh3.googleusercontent.com/UKQB0AQtzkLAy3trR0bVvPspVhcSC9gn2UAZNo2z88yInSNjwv7RPYvIaLRJ5z2YhRBh4OHqOhEmZSeX9SMuFAsUwmkCiilkT1IGzoCvdMrI7FxCaFJ6_C8YbEF4iZYj4uo3BehSbCX-iIUoqaFq9ETzk_pk7xMMrW98SJKqcUZnyn50b236aeMRvvpzGjsqVI5oM99etDq6tRjvJmjPU8wTDmMio8J7lR-mYPyxm8ML2RWyNZQYwrXvqPMk61tF7x2g17q74hi_YU-qPoYkXqJwyxbVl0vC2T6EFIVtYlHeLX_jOjH7no9nCohUppFRRkx0UL_FPlvpPLe2hH5lyh4URnP6nmjlYNLVaSfgLcN3OJ16VrVByb_UwKjkh92y2yxAnX_wn9dnKHzUicwRtzIa6xy-rU2XHNhLBLN1pt--IY5blEReVyRbvxgMnIuh_E_-fJaL0c-zqOAFhxv2yZ72KUGxHjpF7tSIsJYwtcXI-uN5y4RPliPKHTBLGBh3f1mhHa6dX0ofyOBxZ-pfRxa40R-BkCDN9k_xI8IYiGQBUduEfjnRACP-tLTq8M-PKm9kKUI8lLECYJtAuuSSaAll7YtQnp-8lVyMcmG2qwfNC3zZAmHirmjSk1jgEqQcOLP_KVTTdYGNudB_dLdkaM78=w1795-h848-no" alt="Programming" width="438" height="207" /></p>
<p>It’s possible to load up a more custom program for a specialty task through the open ISP header on the board. A pogo pin adapter should make the process of re-flashing the processor easier (<a href="https://www.sparkfun.com/products/11591">pogo adapter</a>). The github repository contains all the necessary code for a basic logger.</p>
<p>The SD card library that comes default with ardunio is horribly slow. I plan to exchange this with SdFat along with storing the data to a binary format. this should allow more data to be stored and the smaller format should allow for a high frequency.</p>
<p><a href="https://github.com/GaitRehabilitation/mini_data_capture/tree/ICM-20948">Project Files</a></p>Introduction The Micro Logger is a small wearable sensor that logs gyro and acceleration data directly to an SD card. This first design was kept very simple and the footprint was minimized down as much as possible. Going forward, there are some basic plans to replace the sd card with an e.mmc module and solder the connections of the battery directly to the board with a charging IC. This should make it possible to charge battery through a micro-usb interface. Variations of this in the future can explore different mem sensors and compare characteristic performance. Hardware