A Fresh Delivery of Power for Valentine’s Day

via SparkFun: Commerce Blog

Hello and happy Valentines Day! We at SparkFun have love in our hearts today - love for our brand new Power Delivery Board! We put a lot of effort into delivering the newest and most useful power accessory you could add to your next project. Let's dive in and take a closer look!

A 'bouquet' of up to 20 volts!

SparkFun Power Delivery Board - USB-C (Qwiic)

SparkFun Power Delivery Board - USB-C (Qwiic)

DEV-15801
$24.95

Traditional power adapters can provide a wide range of current but the voltage stays fixed at 5V. The SparkFun Power Delivery Board's USB-C connection has the ability to achieve higher voltages, typically 5-20V, and up to 100W of power. The Power Delivery Board uses a standalone controller to negotiate with the power adapters and have them switch to a higher voltage other than just 5V. This uses the same power adapter for different projects rather than relying on multiple power adapters to provide different output voltages. The Power Delivery Board is also part of SparkFun’s Qwiic Connect System, so you won’t have to do any soldering to figure out how things are oriented.


FPC Camera Connector - 24-Pin, 0.5mm (Bottom-Contact)

FPC Camera Connector - 24-Pin, 0.5mm (Bottom-Contact)

COM-16305
$0.95

This 24-Pin FPC connector has a 0.5mm pitch, and comes with a bottom contact in a right angle orientation and a surface mount termination. This connector has a current rating of 500mA and a voltage rating of 50V. These 0.5mm pitch connectors provide a cost-effective, higher pin count flex connector solution. A traditional sliding actuator secures the cable.


That's it for this week! As always, we can't wait to see what you make! Shoot us a tweet @sparkfun, or let us know on Instagram or Facebook. We’d love to see what projects you’ve made!

Never miss a new product!

comments | comment feed

Enginursday: A New Sensory Experience with the Cthulhu Shield

via SparkFun: Commerce Blog

Many years ago I worked in the medical field helping those with physical and mental disabilities. Assistive/adaptive technology can be both prohibitively expensive and proprietary. This makes it hard to afford, and difficult to adapt to a particular need. When I heard that a local company was creating "the world's first open source sensory substitution/sensory augmentation development platform for Arduino," I grabbed my RedBoard Qwiic and eagerly started planning a project.

Redboard Qwiic

The Cthulhu Shield

For those unfamiliar with the Cthulhu Shield, it is an R3 footprint Arduino shield able to output to and take input from an electrode array that is placed on your tongue. This allows for an individual to control things like a mouse with only their tongue. It also allows for data output to the electrode array, where it produces sensation through biphasic voltage pulses on the electrode. The resulting sensation is akin to Pop Rocks candy. I wanted my project to be portable, so I powered my RedBoard with a simple 9V battery.

Cthulhu Shield

Cthulhu Shield

SEN-15897
$75.00

alt text

If you are interested in the science behind it, or want to learn more about the company I recommend viewing their Kickstarter Page.

Electrode Array
Here we go!

Sensory Substitution with Distance Sensing

I wanted to test out how well I could rely on a sensor in place of my eyes to navigate the building. I used our VL53l1x Distance Sensor and set three different thresholds. If a detected object was under 3 feet away, the electrodes would be set to an intense output; between 3-10 feet, a medium output; and no output if the object is over 10 feet away.

alt text

What is it like to be a bat?

#include <Cthulhu.h>

#include <ComponentObject.h>
#include <RangeSensor.h>
#include <SparkFun_VL53L1X.h>
#include <vl53l1x_class.h>
#include <vl53l1_error_codes.h>

#include <Wire.h>
#include "SparkFun_VL53L1X.h"



int started = 0;



SFEVL53L1X distanceSensor;
//Uncomment the following line to use the optional shutdown and interrupt pins.
//SFEVL53L1X distanceSensor(Wire, SHUTDOWN_PIN, INTERRUPT_PIN);


Cthulhu mycthulhu; //creating and instance of Cthulhu



int array[18];

//array to hold which electrodes should be on or off.
int trodes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

//pulse period for each electrode, in microseconds. Can be manipulated with Pp and IN to change the intensity of the sensation.
int  PP[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};

//length of positive pulse for each electrode, in microseconds. Can be manipulated with PP and IN to change the intensity of the sensation.
int  Pp[] = {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};

//inner burst number (how many pulses in each inner burst). Can be manipulated with PP and Pp to change the intensity of the sensation.
int  IN[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};

//inner burst period.  In microseconds. Can change quality, or 'feel' of sensation.
int  IP[] = {150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150};

//Outer burst number. Can change quality, or 'feel' of sensation.
int  ON[] = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5};


//Requirements:
//Pp must be less than PP.                    CheckWaveform Error 1.
//(PP*IN) must be less than IP.               CheckWaveform Error 2.
//IP*IN must be less than 2000 microseconds.  CheckWaveform Error 3.


void setup(void)
{
  Serial.begin(9600);

}

void loop(void)
{


  mycthulhu.Begin(); //Initialize Cthulhu library
  oldone();

  distance();
}





void oldone()
{



  //mycthulhu.Begin(); //Initialize Cthulhu library
  //check our waveform parameters and verify that they meet requirements
  int myerror = mycthulhu.CheckWaveform(trodes, PP, Pp, IN, IP, ON);

  if (myerror == 0) //if our waveform parameters are ok, update the stimulation parameters and perform one 36ms stimulation cycle.
  {
    mycthulhu.UpdateStimuli(trodes, PP, Pp, IN, IP, ON); //update waveform parameters
    mycthulhu.Stimulate(); //create the stimulation pulsetrain on the electrodes
  }
  else
  {
    //if we entered an invalid waveform, tell us which rule we violated so we can fix it
    Serial.print("Error in waveform parameters. CheckWaveform Error: "); Serial.println(myerror);
  }
  // Wire.end();
  delay(100); // increased delay to avoid eagleye conflict.
}

void distance ()
{




  distanceSensor.begin();



  distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
  int distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
  distanceSensor.stopRanging();

  Serial.print("Distance(mm): ");
  Serial.print(distance);

  float distanceInches = distance * 0.0393701;
  float distanceFeet = distanceInches / 12.0;

  Serial.print("\tDistance(ft): ");
  Serial.print(distanceFeet, 2);

  Serial.println();
  if ( distanceFeet < 3)
  {
    for (int i = 0; i < 18; i++)
    {
      trodes[i] = 1;
      PP[i] = 40;
      Pp[i] = 39;
      ON[i] = 8;

    }
  }

  if (( distanceFeet < 10) && (distanceFeet > 3))
  {
    for (int i = 0; i < 18; i++)
    {

      trodes[i] = 1;
      PP[i] = 10;
      Pp[i] = 9;
      ON[i] = 5;

    }
  }
  if ( distanceFeet > 10)
  {

    for (int i = 0; i < 18; i++)
    {
      trodes[i] = 0;
      PP[i] = 10;
      Pp[i] = 9;
      ON[i] = 5;

    }
  }

}
SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic)

SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic)

SEN-14722
$21.95
8

Sensory Augmentation with Eagle Eye IR sensor

When I was thinking of what new sense I wanted to have, I immediately thought of a certain alien hunter - a predator, if you will - that used infrared vision to track its prey. Snakes also have a pit organ that allows them to use IR.

I used our Eagle Eye IR sensor, which conveniently already uses a grid array, and I reduced the resolution from 64 points to 16 for the Cthulhu Shield. This allowed for some positional sensation. If a "hot" object approached from my left into the field of view I would first feel it on the left side of my tongue. As the object moved through my FOV, or as I moved my sensor toward the object, I could feel when it was centered in front of the sensor.

Naturally, I attached the sensor to a mask, placed the electrodes in my mouth, grabbed a Nerf gun and started the hunt.

alt text
Get to the Chopper!

#include <Cthulhu.h>
#include <Wire.h>
int started = 0;

#include <SparkFun_GridEYE_Arduino_Library.h>


#define HOT 30
#define COLD 20

// This table can be of type int because we map the pixel
// temperature to 0-3. Temperatures are reported by the
// library as floats
int pixelTable[64];
//int transarray[64];
GridEYE grideye;



Cthulhu mycthulhu; //creating and instance of Cthulhu



int array[18];


//two arrays I used to generate geometric patterns

int cElectrodeMap[5][4] =
{
  {0, 0, 1, 0},
  {2, 3, 4, 5},
  {6, 7, 8, 9},
  {10, 11, 12, 13},
  {14, 15, 16, 17}
};

int on[5][4] =
{
  {0, 0, 0, 0},
  {0, 0, 0, 0},
  {0, 0, 0, 0},
  {0, 0, 0, 0},
  {0, 0, 0, 0}
};


//array to hold which electrodes should be on or off.
int trodes[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

//pulse period for each electrode, in microseconds. Can be manipulated with Pp and IN to change the intensity of the sensation.
int  PP[] = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40};

//length of positive pulse for each electrode, in microseconds. Can be manipulated with PP and IN to change the intensity of the sensation.
int  Pp[] = {39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39};

//inner burst number (how many pulses in each inner burst). Can be manipulated with PP and Pp to change the intensity of the sensation.
int  IN[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};

//inner burst period.  In microseconds. Can change quality, or 'feel' of sensation.
int  IP[] = {150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150};

//Outer burst number. Can change quality, or 'feel' of sensation.
int  ON[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};


//Requirements:
//Pp must be less than PP.                    CheckWaveform Error 1.
//(PP*IN) must be less than IP.               CheckWaveform Error 2.
//IP*IN must be less than 2000 microseconds.  CheckWaveform Error 3.

void setup(void)
{

}

void loop(void)
{


  mycthulhu.Begin(); //Initialize Cthulhu library
  oldone();

  Wire.begin();


  Serial.begin(115200);
  eagle();
}

void oldone()
{



  //mycthulhu.Begin(); //Initialize Cthulhu library
  //check our waveform parameters and verify that they meet requirements
  int myerror = mycthulhu.CheckWaveform(trodes, PP, Pp, IN, IP, ON);

  if (myerror == 0) //if our waveform parameters are ok, update the stimulation parameters and perform one 36ms stimulation cycle.
  {
    mycthulhu.UpdateStimuli(trodes, PP, Pp, IN, IP, ON); //update waveform parameters
    mycthulhu.Stimulate(); //create the stimulation pulsetrain on the electrodes
  }
  else
  {
    //if we entered an invalid waveform, tell us which rule we violated so we can fix it
    Serial.print("Error in waveform parameters. CheckWaveform Error: "); Serial.println(myerror);
  }
  //Wire.end();
  delay(100); // increased delay to avoid eagleye conflict.
}

void eagle ()
{
  int x = 0;
  //Wire.begin();
  grideye.begin();

  // loop through all 64 pixels on the device and map each float value to a number
  // between 0 and 3 using the HOT and COLD values we set at the top of the sketch
  for (unsigned char i = 0; i < 64; i++) {
    pixelTable[i] = map(grideye.getPixelTemperature(i), COLD, HOT, 0, 3);
  }


  // loop through the table of mapped values and print a character corresponding to each
  // pixel's temperature. Add a space between each. Start a new line every 8 in order to
  // create an 8x8 grid
  for (unsigned char i = 1; i < 64; i++) {
    if (pixelTable[i] == 0) {
      Serial.print(".");
      if ( (i % 4 ) == 0)
      {
        trodes[i / 4] = 0;
      }
    }

    else if (pixelTable[i] == 1) {
      Serial.print("o");
      if ( (i % 4 ) == 0)
      {
        trodes[i / 4] = 1;
      }
    }
    else if (pixelTable[i] == 2) {
      Serial.print("0");
      if ( (i % 4 ) == 0)
      {
        trodes[i / 4] = 1;
      }
    }
    else if (pixelTable[i] == 3) {
      Serial.print("O");
      if ( (i % 4 ) == 0)
      {
        trodes[i / 4] = 1;
      }
    }
    Serial.print(" ");
    if ((i + 1) % 8 == 0) {
      Serial.println();
    }
  }

  // in between updates, throw a few linefeeds to visually separate the grids. If you're using
  // a serial terminal outside the Arduino IDE, you can replace these linefeeds with a clearscreen
  // command
  Serial.println();
  Serial.println();


  // toss in a delay because we don't need to run all out
  delay(100);


}
SparkFun Grid-EYE Infrared Array Breakout - AMG8833 (Qwiic)

SparkFun Grid-EYE Infrared Array Breakout - AMG8833 (Qwiic)

SEN-14607
$40.95

Moving Forward with the Cthulhu Shield

It takes time and practice to start building sensitivity to the position and strength of the electrodes on the array. I changed the output settings on the electrodes to produce as much sensation as I could to help with my uninitiated tongue. I plan on reducing this as I get better at parsing out strength and position of the electrodes. I also experienced an issue when using I2C devices where if I completely bit down on the electrode it would cause the board to freeze where it was in the loop. As a result I needed to gingerly place it on my tongue or block one of the electrodes with some plastic to prevent the freeze up. I am not sure why this occurred, but that is what oscilloscopes and GitHub issue requests are for!

Cthulhu Shield attached to Nerd

Ready to sense a whole new world!

With a whole world of sensors and data out there, the limit to the Cthulhu Shield is our imagination. If you could give yourself a new sense what would it be? The ability to sense total Volatile Organic Compounds? Use GPS to help guide yourself to your destination?

comments | comment feed

Arduino 1.8.12 is out!

via Arduino Blog

Today, we are excited to announce the arrival of the Arduino IDE 1.8.12.

Wow! Another release just after two weeks, you ask?

Well, we fixed some serious bugs related to the compiler, and more importantly, we had to take a step back with respect to the transition to the new Java Virtual Machine from OpenJDK. Since we had received so many reports from our users, we decided to do a release with the old JVM in order to have a bit more time to properly handle those issues and at the same time guarantee a better experience to our users.

As usual, if you are curious, you can find the full changelog and contributors in the release notes here.

This retro-looking rotary cellphone is free of modern-day distractions

via Arduino Blog

What we carry today in our pockets is nominally called a “phone,” but more often than not we’re using it to do various other computing tasks. Justine Haupt, however, wanted an actual phone that “goes as far from having a touchscreen as [she could] imagine.”

What she came up with is a rotary cellphone that’s not just a show-and-tell piece, but is intended to be her primary mobile device. It’s reasonably portable, has a removable antenna for excellent reception, a 10-increment signal meter, and, perhaps most importantly, doesn’t make her go through a bunch of menus to actually use it as a phone. Other features include number storage for those she calls most often and a curved ePaper display that naturally doesn’t use any power when revealing a fixed message.

The project was prototyped using an Arduino Micro. It was then laid out of a PCB with an an Adafruit FONA 3G board and an ATmega2560V, programmed in the Arduino IDE.

Haupt has published a detailed look at the build process here.

Code a Kung-Fu Master style beat-’em-up | Wireframe #32

via Raspberry Pi

Punch and kick your way through a rabble of bad dudes in a simple scrolling beat-’em-up. Mark Vanstone shows you how

Although released to tie in with Jackie Chan’s Spartan X, Kung-Fu Master was originally inspired by the Bruce Lee film, Game of Death.

Kung-Fu Master

Kung-Fu Master hit arcades in 1984. Its side-scrolling action, punching and kicking through an army of knife-throwing goons, helped create the beat-’em-up genre. In fact, its designer, Takashi Nishiyama, would go on to kickstart the Street Fighter series at Capcom, and later start up the Fatal Fury franchise at SNK.

In true eighties arcade style, Kung-Fu Master distils the elements of a chop-socky action film to its essentials. Hero Thomas and his girlfriend are attacked, she’s kidnapped, and Thomas fights his way through successive levels of bad guys to rescue her. The screen scrolls from side to side, and Thomas must use his kicks and punches to get from one side of the level to the other and climb the stairs to the next floor of the building.

Our Kung-Fu Master homage features punches, kicks, and a host of goons to use them on.

Making our brawler

To recreate this classic with Pygame Zero, we’ll need quite a few frames of animation, both for the hero character and the enemies he’ll battle. For a reasonable walk cycle, we’ll need at least six frames in each direction. Any fewer than six won’t look convincing, but more frames can achieve a smoother effect. For this example, I’ve used the 3D package Poser, since it has a handy walk designer which makes generating sequences of animation much easier.

Once we have the animation frames for our characters, including a punch, kick, and any others you want to add, we need a background for the characters to walk along. The image we’re using is 2000×400 pixels, and we start the game by displaying the central part so our hero can walk either way. By detecting arrow key presses, the hero can ‘walk’ one way or the other by moving the background left and right, while cycling through the walk animation frames. Then if we detect a Q key press, we change the action string to kick; if it’s A, it’s punch. Then in our update() function, we use that action to set the Actor’s image to the indicated action frame.

Our enemy Actors will constantly walk towards the centre of the screen, and we can cycle through their walking frames the same way we do with the main hero. To give kicks and punches an effect, we put in collision checks. If the hero strikes while an enemy collides with him, we register a hit. This could be made more precise to require more skill, but once a strike’s registered, we can switch the enemy to a different status that will cause them to fall downwards and off the screen.

This sample is a starting point to demonstrate the basics of the beat-’em-up genre. With the addition of flying daggers, several levels, and a variety of bad guys, you’ll be on your way to creating a Pygame Zero version of this classic game.

The generation game

Because we’re moving the background when our hero walks left and right, we need to make sure we move our enemies with the background, otherwise they’ll look as though they’re sliding in mid-air – this also applies to any other objects that aren’t part of the background. The number of enemies can be governed in several ways: in our code, we just have a random number deciding if a new enemy will appear during each update, but we could use a predefined pattern for the enemy generation to make it a bit less random, or we use a combination of patterns and random numbers.

Here’s Mark’s code snippet, which creates a side-scrolling beat-’em-up in Python. To get it working on your system, you’ll need to install Pygame Zero. And to download the full code, go here.

Get your copy of Wireframe issue 32

You can read more features like this one in Wireframe issue 32, available now at Tesco, WHSmith, all good independent UK newsagents, and the Raspberry Pi Store, Cambridge.

Or you can buy Wireframe directly from Raspberry Pi Press — delivery is available worldwide. And if you’d like a handy digital version of the magazine, you can also download issue 32 for free in PDF format.

Look how lovely and glowy it is.

Make sure to follow Wireframe on Twitter and Facebook for updates and exclusive offers and giveaways. Subscribe on the Wireframe website to save up to 49% compared to newsstand pricing!

The post Code a Kung-Fu Master style beat-’em-up | Wireframe #32 appeared first on Raspberry Pi.

Mechanical 7-segment display made with micro servos and an Arduino Mega

via Arduino Blog

Flip displays are an interesting piece of technology, physically moving segments into place that stay put until other information is needed. Michael Klements has been especially fascinated by these devices, and after inspiration from another project, he decided to craft his own.

His version utilizes 14 micro servos to flip segments into a visible position, then rotate them to 90° when no longer needed. This “off” mode displays a slimmer profile, and the sides and back are painted black, making them much less visible.

An Arduino Mega, with 15 possible PWM outputs, is used to control the servos, while a hobby RC-style battery eliminator circuit provides power to the motors. 

Be sure to check out the build process and in-action shots below!