Search This Blog

Friday 3 June 2016

Initial thoughts on creating a Mars Curiosity inspired Rover

It's been a while since I did any "robot" work.  I've been rather absorbed in my 3D Printer firmware.

I thought it was time I took a little side break, and kicked up something I've been thinking about for a while. 

I want to create an autonomous rover based on the concept of the Mars Curiosity Rover.    

No, it won't have a  radioisotope thermoelectric generator (RTG), nor will it have fancy bio-chemical analysis thing-a-ma-bobbers... 

But it will be cool! 




Requirements: 


Independent 6-wheel "rocker-bogie" suspension to allow it to crawl over fairly rough terrain unimpeded.

Neato XV-11 Wheel assembly


I happened to acquire a few Neato XV11 robot vacuums, 
and will be tearing them down for parts.  Each one has a pair of geared motors with optical encoders.  


A Teensy 3.2 will be used for each pair to ensure accurate positioning and velocity profiling. 
Teensy 3.2 for Motion Control

Neato XV-11 LIDAR sensor


The Neato XV-11 also has a very unique LIDAR system for mapping out room dimensions and identifying obstacles.









LIDAR mapping, A* Path planning, and Object Avoidance via multiple Sharp Infra-red proximity sensors will be done on a Raspberry Pi 3B
GPS, as well as a 9 degree of freedom fusion sensor on the chassis will also be managed by this Pi.



A* Path Planning





















A Second Raspberry Pi 3B will be responsible for communications and streaming cameras. Running Nodebots, a javascript engine for Robot management, this Pi will have api's to allow connectivity via Android tablet, as well as a full web server.  


The 4 dof manipulator arm will be managed by another Teensy 3.2 and a separate  9 degree of freedom fusion sensor will sit on the wrist positional feedback.

 


I found on my previous rover, that another set of Infrared proximity sensors were needed on the bottom, front and back.  

Positioned on a 45 degree angle, these "cliff sensors" would alert you when the rover was in danger of falling over the edge of a cliff... ie, a set of stairs.


Similar to my previous rover, I will use a commercial 20,000ma Li-Ion power bank to power the electronics, and a separate Lead Acid 12v battery for the motors and servos.






I am also going to attempt foldable solar panels. Four panels, attached with hinges and servos, will fold away when not in use, but be able to extend off the back, fold out, and position for maximum light transfer when required. 


Any thoughts or suggestions are welcome as I embark on this awesome summer project.



References:

https://en.wikipedia.org/wiki/Curiosity_%28rover%29
http://www.instructables.com/id/How-to-Build-an-Internet-Controlled-Mars-Rover/
https://www.quora.com/What-are-the-reasons-behind-using-rocker-bogie-suspensions-in-mars-curiosity-rover
https://www.sparkfun.com/news/490
https://xv11hacking.wikispaces.com
http://www.nasa.gov/sites/default/files/atoms/files/mars_survival_kit_-_rover_final_4.pdf
http://arduino-pi.blogspot.ca/2014/04/adding-5dof-arm-to-my-autonomour-rover.html
https://www.sparkfun.com/products/242












Wednesday 27 January 2016

I just received an Onion Omega!

Back in May of last year, I became aware of a KickStarter campaign for a new uController board called the  Onion Omega.
The Campaign met it's target goal of $15k USD, and then doubled it within a couple days!

Within a month, they had Successfully raised $267,851 USD with 4,459 backer.

What makes this little board incredible besides it's diminutive size, are it's enormous specs! 

  • Dimensions: 28mm x 42mm 
  • OS: OpenWRT Linux 
  • Processor: 400MHz 32bit Broadcom Atheros AR9331
  • RAM: 64MB DDR2 
  • Flash: 16MB 
  • Wireless: 802.11 b/g/n 
  • Ports: 18 GPIO 
  • Language: Python, Node.JS, PHP, Ruby, Lua and more...


These  specs put this cool little board smack dab between the 8bit loveable Arduino and it's big 32bit brother, the RaspberryPi.

The 18 GPIO are  all digital, however there are I2C, I2S, and SPI buses for expansion should you require analog support.

The biggest "feature" of this awesome little board is the Web Interface!   The Onion Console is intended to represent a virtual desktop in your browser to control applications running on the Onion Omega!


How cool is THAT???

Anyway, cutting to the chase... A couple weeks ago, on Twitter,  @OnionIoT held a giveaway contest, and I entered... I mean, who wouldn't?  I've been working with embedded controllers and System on Chip boards for a while now, and this one definitely intrigues me. 

The following day, I received THIS tweet:
 YES!!!!   

And today finally, my board, plus a dock showed up!  



Now go away... I have some playing to do!   

Thank you Onion.io 

 

References:


 


Friday 22 January 2016

Thermistor to Temperature conversion in ARM-mbed

This is a short article about how to quickly convert a Thermistor Value to Temperature on the Freescale (Now NXP) FRDM-K64F board.  Honestly, this code will work for any of the FRDM boards, as there is nothing specific to the K64F.

The FRDM-K64F developer board from NXP  (formerly Freescale) is a 32bit ARM® Cortex™-M4 core with DSP instructions and Floating Point Unit (FPU)running at 120 Mhz. It has 1M flash memory and 256k RAM.   It is compatible with most Arduino shields.

Add to this:
  •  FlexBus, 
  • 16 channel DMA, 
  • 2 16bit ADC, 
  • 2 16bit DAC, 
  • 3 analog comparators, 
  • CANbus, 
  • 3 SPI ports, 
  • 3 I2C ports, 
  • 6 UARTs, 
  • 1 Secure Digital Host Controller, 
  • Ethernet, 
  • Micro-SD card
  • Hardware CRC and random-number generator module, 
  • Hardware encryption supporting DES, 3DES, AES, MD5, SHA-1 and SHA-256 algorithms
  • 6-axis combo Sensor Accelerometer and Magnetometer

NXP/Freescale do have their own free IDE available, the Kinetis Design Studio that I've discussed here in the past. It is quite a rich and capable development platform, however with that richness comes complexity.  

For those less familiar with configuring hardware clocks and startup code for embedded processors, I suggest you look at the ARM-mbed platform.



ARM-mbed is a fairly good online IDE for working with various ARM based developer boards.







I was rummaging through my code today, and found this piece that I had struggled with last year when I was working on my 3D printer firmware.  I wanted to be able to read two thermistors, one for the extruder nozzle, and one for the heated bed.  These thermistors are used to regulate the temperature for accurate printing.

Several of the standard 3D printer firmware options (Marlin, Teacup, etc...)  that were developed for the 8bit Arduino platform used conversion tables to reduce the processing overhead. Because I was using a 32bit ARM processor at 120Mhz, I didn't feel that this was the right method to follow.  
Looking around, I quickly found out about the  Stenhart-Hart equation for converting Thermistor resistance values to Temperature values. 

It looked rather daunting at first, but then Adafruit came to the rescue with this awesome tutorial:


Anyway, with no further ado... here is my demo code for displaying Temperature values from a 16bit analog read of a 100k thermistor on the FRDM-K64F development board.


/*         FRDM-Thermistor-Demo
*  This is a Thermistor to Temerature conversion demo
*  for the @NXP (@freescale) FRDM-K64F demo board
*  Much thanks to @Adafruit for this tutorial:
*  https://learn.adafruit.com/thermistor/using-a-thermistor
*
*  The 100K Thermistor is configured with a 4.7k series resistor
*  tied to vcc (3.3v)  like this:
*
*   +3.3v
*     |
*      \
*      /  4.7k series resistor
*      \
*      /
*      |
*      .-----------O To Anlog pin on FRDM board
*      |
*      \
*      /
*  Thermistor  100k Nominal
*      \
*      /
*      |
*     ---
*   GND
*          
*
*********************************************************************/


#include "mbed.h"

#define THERMISTORNOMINAL 100000      // 100k
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25  
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 4700   
 
AnalogIn Thermistor(A3);

Serial pc(USBTX, USBRX);


// This is the workhorse routine that calculates the temperature
// using the Steinhart-Hart equation for thermistors
// https://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation
float get_temperature()
{
    float temperature, resistance;
    float steinhart;
    int a;
   
    a = Thermistor.read_u16();       // Read 16bit Analog value
    pc.printf("Raw Analog Value for Thermistor = %d\r\n",a);
 
    /* Calculate the resistance of the thermistor from analog votage read. */
    resistance = (float) SERIESRESISTOR / ((65536.0 / a) - 1);
    pc.printf("Resistance for Thermistor = %f\r\n",resistance);
  
    steinhart = resistance / THERMISTORNOMINAL  // (R/Ro)
    steinhart = log(steinhart);                 // ln(R/Ro)
    steinhart /= BCOEFFICIENT;                  // 1/B * ln(R/Ro)
    steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15);   // + (1/To)
    steinhart = 1.0 / steinhart;                // Invert
    temperature = steinhart - 273.15;           // convert to C

    return temperature;
}
  

int main()
{
    pc.baud(115200);   
    pc.printf("\r\nThermistor Test - Build " __DATE__ " " __TIME__ "\r\n");
 
    while(1) { 
       pc.printf("Temperature %f *C\r\n",get_temperature());

       wait(.5);
    }
}


    

References:
NXP.COM: FRDM-K64F Developer board
ARM-mbed: FRDM-K64F 
Adafruit: Using a thermistor to tell temperature 

Wednesday 21 October 2015

My Reprap Prusa i3 Kit [ second of a multipart blog] - The Build!

This past weekend, I finally had the time to start building my Reprap Prusa i3 3D Printer,  which I ordered a few weeks ago from  Shenzhen Sunhokey Electronics Co., Ltd. on Aliexpress.com

 

 

 

 

 

 

  

 

 

The kit came with a DVD which included about a dozen videos of the step-by-step assembly process.  There is no speech in the videos, just some background music, and periodic overlay of the hardware required to assemble each step.

 

The videos run at a fairly leisurely pace, but yes... I did have to pause them many times to keep up. 

 

Here's a sample video to show you what 

the process looks like.

 The build started fairly smoothly, with the X-axis motor block and opposite belt tensioner slider assemblies. (Yeah, I'm too lazy to look up the official names of these two components)



 

 

 

My Assistant and fellow builder - Camden, found himself getting rather tired, early into the build! But, like a trooper, he put in a good couple hours.  Thank you Camden.




Next up, was the actual hotend carriage assembly.  I'll have to admit, it was very exciting to see these pieces built first.  Good job Shenzhen Sunhokey Electronics Co., Ltd.!  

At first, I wasnt sure how I would feel about the transparent acrylic frame and parts, but as the build progressed, I grew rather fond of it.

 





 

 

 

Next came Z-Axis Motor brackets, end stops, and then the frame and rails for the Y-Axis heated bed


I wrapped up for the weekend at this point.  Two days of "duration", and about 6 hours of "effort".   

 

 

The next three articles over the upcoming week will be: 

1) wiring all of the motors, switches, heaters, etc to the control board and firing it up.   

2) calibrating and troubleshooting (probably not in that order!)  

3) finally running a first print. 

 

Cheers.

 

 

Tuesday 13 October 2015

My Reprap Prusa i3 Kit [ first of a multipart blog] - The unboxing!



I finally bit the bullet, and ordered an actual real 3d Printer from Aliexpress.com.  I've needed an actual functioning mechanical printer to finish my testing and calibration on the Printer firmware that I've been working on for several months now. 

The homemade rig that I cobbled together was not capable of the tolerances that my firmware and electronics could theoretically achieve.

I've put it off until now for many reasons:  Mostly because I'm pig headed and didn't want to admit that I'm not a mechanical genius....

Anyway, a few friends convinced me that this was the right way to go, to finish my ACTUAL project, which was the combination of electronics and associated software/firmware to support it.


The kit I ordered was from    Shenzhen Sunhokey Electronics Co., Ltd.

I must say that I was rather impressed with the speed in which this kit was delivered from China to Canada. From the time I ordered, it took about a business week to process the order, but once I received notification that the package had shipped, It was here with about 4 days.   Thank you Aliexpress.com


Without further ado, let's begin the unpacking:


The Fedex dude pretty much had a hernia dropping this little box at my door.  The packaging said 13.5kg, which is about 30lbs for you Americans... But it felt a lot heavier than that.  Must make a note to self to return (go?) to the gym.
















I've removed the thick protective foam top that covered everything to show that this is indeed very well packaged.  








With the box containing the acrylic frame components removed, you can see the electronic and mechanical components nestled tightly within the foam.





The distributor even has little cutouts to cover the stepper motors and linear and threaded rods!









 


 

The aluminum bowden extruder was pre-assembled to the stepper motor, and the machining on the hotend looks to be quite good.








 The power supply is a beefy 12v 30A (360watt) unit.  

My only complaint, is that I was not aware that you had to specify North American AC adapter.  It comes, by default, with a European adapter.  



Yeah, I'm RTFM challenged, ok!?



The Controller board is a MKS Gen 2Z v1.1
This is basically a combination of the Arduino MEGA2560 plus a RAMPS1.4 board.  It still uses the A4988 stepper driver boards. 

Included in this kit is an un-named LCD display with SDCARD and a rotary encoder for menu selection. 
 






All of the frame components are cut out of clear acrylic. (With a nice pink protective layer... hmmm... should I leave that on? )














Also included were two 1kg spools of 1.75mm PLA to get me started.
I didn't request any particular colors, so I kind of expected something funky.  

They provided Black and White, which I'm quite happy about.





That's it for now.  

Later in the week, I'll begin assembling and documenting.  

Wish me luck!

Saturday 18 April 2015

How we learned about electronics pre-Arduino days...

Very short post here: 

I was cleaning the basement, and came across this. It is "brand new", as in everything was still wrapped in it's original bubble wrap and had the cardboard corner protectors... huh... go figure..

Anyway boys and girls... this is what an Arduino looked like 20+ years ago.  LOL

130 rainy day electronics projects in one box...  

I tend to be a very forgetful person, but I *vividly* remember MY first computer.  

In 1976, Popular Electronics Magazine ran an article about building your very own personal computer.

The "Cosmac ELF was basically a PCB that you purchased, sourcing all of the electronic parts through the mail.  I think at the age of 10, it took me several months to get the components.  Sending off for one of two as my allowance came in, and soldering them to the circuit board. 

Picture from : http://www.homebrewcpu.com/projects.htm
Using an 8bit RCA 1802 processor meant for the newly invented digital gas pumps, the Cosmac Elf boasted 256 bytes (BYTES!) of memory, two 7 segment LEDs, 8 toggle switches for address and data input, a RUN switch, and a PROGRAM switch.  

No BIOS or bootloader... nada... and yet some simple games could be loaded (in binary!) and played for hours of fun.



Two years later, I was up to 4k of memory, a cassette tape drive, and a monochrome video display of 128x64 bits...  and a home rolled character generator!

Those were the days...

I'd LOVE to hear your stories in the comments below...



Friday 17 April 2015

PlatformIO - A Cross-Platform Code Builder and Missing Library Manager

I ran across this awesome site a couple weeks ago, and was astounded by their claims.  I had to try it out!

In a nutshell, PlatformIO has automated the various build aspects of cross compiling for your favorite Microcontroller across Mac OS X, Windows, and Linux, both on Intel as well as ARM (Meaning you can run PlatformIO on your Raspberry PI, or Beagle Board!)   

Basically, you can write your embedded code once, and compile across several target boards with very little additional work.

PlatformIO for each Operating system includes compiler, debugger, uploader (for embedded) and a bunch of useful tools. Popular settings for most popular Embedded Platform Boards are pre-configured out of the box.

To date, PlatformIO out-of-the-box support includes:



And of Special NotePlatformIO.org has worked with the guys that developed the Teensy 3.1 board to include it in their supported systems.  I make note of this, as the Teensy does use the Freescale Kinetis K20dx256 32bit ARM cortex-4 MCU, but they have simply made this board more readily available to work with.  (I also have a vested interest in this board!) 


Once installed, you can get a list of the 60 or more supported boards by typing “platformio boards” ...


 It's really as simple as installing PlatformIO onto your Laptop, Desktop, or Single board Computer (Raspberry Pi, BeagleBone, etc...), and choosing your target Embedded System to develop for. 

You Install PlatformIO itself, then invoke it to install the toolsets and libraries for your preferred board/processor,
something akin to  "platformio install freescalekinetis"  and it pulls down all of the cross compiler tools, and kinetis core libraries.

You then initiate a project with "platformio init -bteensy31".  It creates the directory structure, and you are free to use your favorite editor/IDE to write the code. 

No... this is not Visual Studio / Programming-with-your-mouse tool, but it DOES take care of a lot of the planning, configuration, build, and upload issues for you.

Once you have written your code, again invoking PlatformIO to build and upload is a simple process..  "platformio  run -t upload"... 




PlatformIO Library Manager allows you to organize external libraries. Searching for new libraries can be via commandline or Web Interfaces.  Python code in the background takes care of the rest.  Think of this as a package manager for your embedded libraries.










My fellow Teensy developers... If you feel constrained by the limitations of the  Arduino IDE (even though they did such an awesome job extending it with Teensyduino) And you are not up to the complexity of a full fledged bloated developer suite.. Please do yourself the favor, and try out PlatformIO.


References:

PlatformIO.org 
Cross-board and cross-vendor embedded development with PlatformIO 
Discovered a new tool for embedded development: PlatformIO 
Integration of PlatformIO library manager to Arduino and Energia IDEs
Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO