Monthly Archives: May 2019

Friday Product Post: Go Nuts and Bolts for JetBot!

via SparkFun: Commerce Blog

How's it going, everyone? This week we are excited to introduce you to a full-fledged JetBot kit for the Jetson Nano. That's right – it's not just a parts kit, we include everything you need to start using the AI robotics kit right away! We also have a new version of the LoRa Raspberry Pi Gateway, a right-angle jig for a 5mm LED, and a 0.5W super thin speaker.

SparkFun JetBot AI Kit Powered by NVIDIA Jetson Nano

SparkFun JetBot AI Kit Powered by NVIDIA Jetson Nano

KIT-15365
$274.95

The JetBot is an open source robot platform based on the Jetson Nano Developer Kit by NVIDIA. JetBot is a great launchpad for creating entirely new AI projects for makers, students and enthusiasts who are interested in learning AI and building fun applications. It’s straightforward to set up and use, and is compatible with many popular accessories. Several interactive tutorials show you how to harness the power of AI to teach JetBot to follow objects, avoid collisions and more. Jetson Nano Developer Kit offers useful tools like the Jetson GPIO Python library, and is compatible with common sensors and peripherals, including an expanding Python compatibility with the SparkFun Qwiic ecosystem.


Open the gates!

LoRa Raspberry Pi Gateway with Enclosure

LoRa Raspberry Pi Gateway with Enclosure

WRL-15336
$199.95

The LoRa Raspberry Pi Gateway is a professional grade gateway with the hacker in mind. While other low-cost gateways are a single channel, the LoRa Raspberry Pi Gateway comes with a fully heat-sinked concentrator capable of multi-channel, multi-node communication all running in a friendly, hackable Raspberry Pi environment.


Thin Speaker - 0.5W

Thin Speaker - 0.5W

COM-15350
$0.95

If you want to get some sound out of your project but have a tight space budget, this is a good way to do it. This 0.5W, 8Ohm speaker is only 40mm in diameter and just over 4mm thick, the same kind you might find in one of those talking greeting cards.


Right Angle LED Jig - 5mm

Right Angle LED Jig - 5mm

PRT-15315
$0.75

Have you ever wanted to mount 5mm LEDs to the side of your board? We got these right-angle LED jigs for our RedBoard Edge and loved them. They are really just small pieces of plastic to hold your LEDs while bending the legs over. You'll notice that there is a small amount of room between the LED and the housing. Most LEDs come with a small lip around the base, so we needed to make the hole a bit larger to get that lip to fit, but they should work with any standard 5mm LED (with two legs).


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!

comments | comment feed

Enginursday: Keycode Security Starter, Part 1

via SparkFun: Commerce Blog

If you are like me, you enjoy the charm of driving an older vehicle. The mechanical feedback from the car is more organic. You aren’t surrounded by safety and driver aid systems that jump at the opportunity to correct your oh-so human actions. These cars were born in an era when manufacturers strove to have their own look. Shoot, you still get to plug the key into the ignition! You get the point, but as much as the above is appealing, there are many shortcomings in older vehicles, one of the primary being security.

Nowadays, most cars come with keyless ignition systems as standard equipment. This technology has been used in the industry since the late nineties in high-end automobiles, and only in the last decade or so has this system made its way to the masses. These systems can certainly come with their own set of headaches, but they do make auto theft much more difficult when using less tech-savvy methods.

My goal here is to create a keycode-based security system for starting my 80’s-era soon-to-be daily driver.

Disclaimer: the motor for said daily driver is still not actually in the car, so installation of this system will be covered in a future post. This system is designed to function with a starter circuit found in a 1980’s-era Volvo.

The primary motivations behind installing this system are to disable the ability to start the vehicle without entering the proper keycode, and to make the act of “hot-wiring” the vehicle much more difficult. The intention is to be as non-invasive as possible, so this system does not require the removal of any OEM parts included in my vehicle’s starting circuit.

Concept

The photo below illustrates the concept. Lets walk through it and talk about some reasoning.

alt text

In this basic implementation I am using the car battery to supply power to my microcontroller. In this case I’m opting to use the Sparkfun Thing Plus – ESP32 WROOM . I chose this board because of its potential – most basic microcontroller boards could perform the task needed, but I want to keep adding features and capabilities to this system, and the wireless and battery capabilities offer a lot of feature expansion. If I were simply installing the system depicted in the picture without the intention of adding to it, I might have opted for the less expensive Arduino Pro Mini.

alt text

Power is supplied to the microcontroller after the ignition switch, which, if functioning properly, should prevent the board from being powered up when the ignition switch is in the OFF position. This will keep the microcontroller from draining the car battery while the car is not in use and the battery is not being charged by the alternator. In the future, the onboard JST and LiPo charger of the Sparkfun Thing Plus could come in handy.

alt text

Now, I can’t just supply my Sparkfun Thing Plus with 12V from the ignition, so I’m using the Sparkfun Buck-Boost Converter to regulate that voltage down to 5V, which will then be routed to the Sparkfun Thing Plus’s VUSB pin. I will likely be placing a 1A or 500mA fuse between the 12V supply of the ignition and the Buck-Boost board. This should protect my ignition circuit in the chance that something I have added shorts.

alt text

From there I am utilizing the Sparkfun Qwiic Keypad – 12 Button as my HID device. This will live in the cabin of the car and will be used to enter the keycode. I’m connecting the keypad to my Thing Plus with a 100mm Qwiic Cable.

alt text

The next and most integral component is the Sparkfun Qwiic Single Relay. This board uses a ATTiny85 to act as an I2C slave and controls the the relay, allowing the user to open and close the relay using I2C communication. The Qwiic Relay will be acting as another switch on the starter solenoid power cable running from the ignition switch to the starter solenoid. When the relay is open, it should prevent current from reaching the starter solenoid. By controlling the current path to the starter solenoid, I can prevent the starter from engaging, and thus prevent the car from being started (in most cases).

Because this component will be under the hood, I opted to use some 22AWG wire to connect my Thing Plus to the Qwiic Relay. I will likely end up using some heat shielding on the wires and an enclosure for the Qwiic Relay to protect the parts from the heat of the engine bay and the elements.

alt text

I also want to include an option to bypass the Qwiic Relay. To do this, I’m going to use this toggle switch rated for 20A and 12V, which will be wired up in parallel with the Qwiic Relay on the starter solenoid control line.

Placing both the Qwiic Relay and the toggle switch under the hood should make hot-wiring the car much more difficult, requiring the would-be thief to go under the hood to reconnect the starter solenoid control line. Or just flip the switch... if they can find it.

At this point, it’s worth mentioning that I will be using at least 8AWG stranded wire to connect the Qwiic Relay and the toggle switch to the starter solenoid control line. This gauge of wire is large enough to safely handle the current of the starter solenoid control line, and should be available at any automotive parts store.

Mini DEMO

alt text

Above is a demo using a RedBoard Qwiic and a Qwiic Keypad to successfully close the Qwiic Relay when the proper keycode is entered. In this case the code is “1243.”

Below is the sketch I am using in the demo above:

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

#define COMMAND_RELAY_OFF     0x00
#define COMMAND_RELAY_ON      0x01

const byte qwiicRelayAddress = 0x18;     //Default Address

KEYPAD keypad1; //Create instance of this object

const char keyCode[] = {'1','2','3','4'};  //enter code here

char userEntry[] = {0, 0, 0, 0}; // used to store the presses coming in from user
boolean userIsActive = false; // used to know when a user is active and therefore we want to engage timeout stuff

#define TIMEOUT 30 // 100s of milliseconds, used to reset input. 30 equates to 3 second.
byte timeOutCounter = 0; // variable this is incremented to keep track of timeouts.

byte userEntryIndex = 0; // used to keep track of where we are in the userEntry, incremented on each press, reset on timeout.

#define stat_LED 13

void setup() {

  Serial.begin(9600);

  Wire.begin(); // join the I2C Bus

  if (keypad1.begin() == false)   // Note, using begin() like this will use default I2C address, 0x4B. 
                  // You can pass begin() a different address like so: keypad1.begin(Wire, 0x4A).
  {
    Serial.println("Keypad does not appear to be connected. Please check wiring. Freezing...");
    while (1);
  }

  testForRelayConnectivity();
  relayOff();

  pinMode(stat_LED,OUTPUT);
  digitalWrite(stat_LED, HIGH);
  delay(250);
  digitalWrite(stat_LED, LOW);

  Serial.println("Car Starter ready for operation!");
  Serial.println("Keypad Car Starter Menu:");

}

void loop(void) 
{

  keypad1.updateFIFO();  // necessary for keypad to pull button from stack to readable register
  char button = keypad1.getButton();

  if (button == -1)
  {
    Serial.println("No keypad detected");
    delay(1000);
  }
  else if (button != 0)
  {
    //Serial.print(button);
    userEntry[userEntryIndex] = button; // store button into next spot in array, note, index is incremented later
    printEntry();
    userIsActive = true; // used to only timeout when user is active
    if (checkEntry() == true)
    {
      relayOn();
      digitalWrite(stat_LED, HIGH);
      Serial.println("\n\r\n\rReady to start!");
      clearEntry();
      userIsActive = false; // don't display timeout stuff.
      delay(1000);
      digitalWrite(stat_LED,LOW);
    }
    userEntryIndex++;
    if ( userEntryIndex == sizeof(keyCode)) userEntryIndex = 0; // reset
    timeOutCounter = 0; // reset with any new presses.
  }

  delay(100); //10 is good, more is better, note this effects total timeout time

  timeOutCounter++;

  if ((timeOutCounter == TIMEOUT) && (userIsActive == true)) // this means the user is actively inputing
  {
    Serial.println("\n\r\n\rTimed out... try again.");
    timeOutCounter = 0; // reset
    userEntryIndex = 0; // reset
    clearEntry();
    //printEntry();
    userIsActive = false; // so we don't continuously timeout while inactive.
  }
}

boolean checkEntry()
{

  for (byte i = 0 ; i < sizeof(keyCode) ; i++)
  {
    if (userEntry[i] == keyCode[i]); // do nothing, cause we're only looking for failures
    else return false;
  }
  return true; // if we get here, all values were correct.
}

// "clear" entry with all spaces
void clearEntry()
{
  for (byte i = 0 ; i < sizeof(userEntry) ; i++)
  {
    userEntry[i] = 0; // fill with spaces
  }
}

void printEntry()
{
  Serial.println();
  Serial.print("UserEntry: ");
  for (byte i = 0 ; i < sizeof(userEntry) ; i++)
  {
    Serial.print(char(userEntry[i]));
  }
  Serial.println();
}


// RelayOn() turns on the relay at the qwiicRelayAddress
// Checks to see if a slave is connected and prints a
// message to the Serial Monitor if no slave found.
void relayOn() {
  Wire.beginTransmission(qwiicRelayAddress);
  Wire.write(COMMAND_RELAY_ON);
  Wire.endTransmission();
}


// RelayOff() turns off the relay at the qwiicRelayAddress
// Checks to see if a slave is connected and prints a
// message to the Serial Monitor if no slave found.
void relayOff() {
  Wire.beginTransmission(qwiicRelayAddress);
  Wire.write(COMMAND_RELAY_OFF);
  Wire.endTransmission();
}


// testForConnectivity() checks for an ACK from an Relay. If no ACK
// program freezes and notifies user.
void testForRelayConnectivity() {
  Wire.beginTransmission(qwiicRelayAddress);
  //check here for an ACK from the slave, if no ack don't allow change?
  if (Wire.endTransmission() != 0) {
    Serial.println("Relay does not appear to be connected. Please check wiring. Freezing...");
    while (1);
  }
}

Maybe I'm overestimating the desire to steal this car? Nope, the desire is there... I see it in their eyes.

Stay tuned for part two, where I detail a step-by-step installation in the vehicle. In the meantime, let us know about hacks you have made on your vehicle, the issues you encountered and what you have planned next.

comments | comment feed

LED Gumball Machine

via SparkFun: Commerce Blog

Recently, Nate took some time off from creating new boards to work on a project for the BTU Lab at CU Boulder. With this simple machine, students are easily able to dispense a handful of LEDs, since no one seemed to be refilling parts bins (we're looking at you, Chad). It might surprise you how fast a thousand LEDs disappear: two weeks... that's it. With this LED Gumball Dispenser, the LEDs last for more than a semester. It’s amazing how a 15-second pause will cause people to think twice.

New!

LED Gumball Machine

April 24, 2019

Hacking gumball machines to make the world a happier, blinkier place.

So, if you are a teacher and are tired of refilling bins for your students (it also doesn't have to be LEDs; it could be small gifts, buttons or anything you want), or you simply want to make your own gumball dispenser, it's surprisingly easy. With the above tutorial, Nate walks you through each step to make your own LED Dispensing Machine with all the programming on a single Arduino.

comments | comment feed

How’s the Weather Up There?

via SparkFun: Commerce Blog

Springtime in the Rockies can bring with it some very interesting weather. So this week, I decided to grab our SparkFun micro:climate kit for micro:bit, put it all together and see exactly what was happening outside our windows here at SparkFun HQ. I've programmed it to record and broadcast temperature, humidity, wind speed, wind direction and rainfall, although that last one takes a bit of patience. And while my desk is right on the edge of the micro:bit's Bluetooth radio range with the interference that the building creates, I can walk over to the breakroom and watch all the information scroll by perfectly on my second micro:bit. And by using the SparkFun OpenLog (included in the kit) to record all of the data to a file every sixty seconds, I can always go back and see what happened out there while I was locked inside our windowless studio.

If you haven't yet worked with the micro:bit, or if you want to start digging into block coding (with Microsoft MakeCode), MicroPython or even JavaScript, this kit will help you gain a mountain of working knowledge, with a very gentle learning curve.

comments | comment feed

Raspberry Pi captures a Soyuz in space!

via Raspberry Pi

So this happened. And we are buzzing!

You’re most likely aware of the Astro Pi Challenge. In case you’re not, it’s a wonderfully exciting programme organised by the European Space Agency (ESA) and us at Raspberry Pi. Astro Pi challenges European young people to write scientific experiments in code, and the best experiments run aboard the International Space Station (ISS) on two Astro Pi units: Raspberry Pi 2s and Sense HATs encased in flight-grade aluminium spacesuits.

It’s very cool. So, so cool. As adults, we’re all extremely jealous that we’re unable to take part. We all love space and, to be honest, we all want to be astronauts. Astronauts are the coolest.

So imagine our excitement at Pi Towers when ESA shared this photo on Friday:

This is a Soyuz vehicle on its way to dock with the International Space Station. And while Soyuz vehicles ferry between earth and the ISS all the time, what’s so special about this occasion is that this very photo was captured using a Raspberry Pi 2 and a Raspberry Pi Camera Module, together known as Izzy, one of the Astro Pi units!

So if anyone ever asks you whether the Raspberry Pi Camera Module is any good, just show them this photo. We don’t think you’ll need to provide any further evidence after that.

The post Raspberry Pi captures a Soyuz in space! appeared first on Raspberry Pi.

Create an arcade-style zooming starfield effect | Wireframe issue 13

via Raspberry Pi

Unparalleled depth in a 2D game: PyGame Zero extraordinaire Daniel Pope shows you how to recreate a zooming starfield effect straight out of the eighties arcade classic Gyruss.

The crowded, noisy realm of eighties amusement arcades presented something of a challenge for developers of the time: how can you make your game stand out from all the other ones surrounding it? Gyruss, released by Konami in 1983, came up with one solution. Although it was yet another alien blaster — one of a slew of similar shooters that arrived in the wake of Space Invaders, released in 1978 — it differed in one important respect: its zooming starfield created the illusion that the player’s craft was hurtling through space, and that aliens were emerging from the abyss to attack it.

This made Gyruss an entry in the ‘tube shooter’ genre — one that was first defined by Atari’s classic Tempest in 1981. But where Tempest used a vector display to create a 3D environment where enemies clambered up a series of tunnels, Gyruss used more common hardware and conventional sprites to render its aliens on the screen. Gyruss was designed by Yoshiki Okamoto (who would later go on to produce the hit Street Fighter II, among other games, at Capcom), and was born from his affection for Galaga, a 2D shoot-’em-up created by Namco.

Under the surface, Gyruss is still a 2D game like Galaga, but the cunning use of sprite animation and that zooming star effect created a sense of dynamism that its rivals lacked. The tubular design also meant that the player could move in a circle around the edge of the play area, rather than moving left and right at the bottom of the screen, as in Galaga and other fixed-screen shooters like it. Gyruss was one of the most popular arcade games of its period, probably in part because of its attention-grabbing design.

Here’s Daniel Pope’s example code, which creates a Gyruss-style zooming starfield effect in Python. To get it running on your system, you’ll first need to install Pygame Zero — find installation instructions here, and download the Python code here.

The code sample above, written by Daniel Pope, shows you how a zooming star field can work in PyGame Zero — and how, thanks to modern hardware, we can heighten the sense of movement in a way that Konami’s engineers couldn’t have hoped to achieve about 30 years ago. The code generates a cluster of stars on the screen, and creates the illusion of depth and movement by redrawing them in a new position in a randomly chosen direction each frame.

At the same time, the stars gradually increase their brightness over time, as if they’re getting closer. As a modern twist, Pope has also added an extra warp factor: holding down the Space bar increases the stars’ velocity, making that zoom into space even more exhilarating.

Get your copy of Wireframe issue 13

You can read the rest of the feature in Wireframe issue 13, available now at Tesco, WHSmith, and all good independent UK newsagents.

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 13 for free in PDF format.

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 Create an arcade-style zooming starfield effect | Wireframe issue 13 appeared first on Raspberry Pi.