Peter Nyboer – Blog. by Next Thing https://ntcblogbackup.wpengine.com News & Notes. Process & Projects. No BS. Srsly. Thu, 09 Nov 2017 03:16:07 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 Secure-A-C.H.I.P. https://ntcblogbackup.wpengine.com/secure-a-chip/ Tue, 22 Mar 2016 13:00:35 +0000 http://blog.nextthing.co/?p=308 Security is a big deal. Everyday brings a new story about how hackers are creating networks of bots and stealing information and identities.

It’s easy to dive into using C.H.I.P. without thinking about this stuff, so we want to provide some guidelines on how to make your C.H.I.P. secure. This is especially important if you’re working with C.H.I.P. remotely on a network. You’ll not only want a secure C.H.I.P., but you’ll want the process as streamlined as possible.

Here’s some tips on making it easy to log into your C.H.I.P., make logging in more secure, and make your C.H.I.P. unique so you know it’s yours.


There are three parts to this:

  • Change the default password
  • Change the host name
  • Create a password-free login between one computer and your C.H.I.P.

That last one may not sound very secure, but it’s actually more secure than typing in a password each time, and allows for automated management of your C.H.I.P.. Super slick!


CHANGE YOUR PASSWORD

passwd

It’s so easy, but you probably haven’t done it. From a terminal on C.H.I.P., simply type the command below and follow the prompts.
passwd

Now enter your new password into your password manager. What? You don’t have one? You should – that way, you can have more secure passwords and store them securely. Just research “password manager” in your favorite search engine for your operating system, and come back here when you are done.

Note: Also, make sure to change your root password as well!


CHANGE YOUR C.H.I.P. NAME

hostname
Every C.H.I.P. ships with a default computer name of “chip.” This has little influence on security, but if you are working with more than one C.H.I.P., it’s easy to get lost if they all have the same name. If you have more than one C.H.I.P. on the network and you type ssh chip@chip.local, how do you know where you will end up?

You don’t, really. So the first thing I do with a new C.H.I.P. is give it a new hostname. There’s two places you need need to change the word chip to your new name:
sudo nano /etc/hostname

and

sudo nano /etc/hosts

If you changed chip to totopo you can now ssh chip@totopo.local. If you reboot, you’ll see a new prompt that looks like: chip@totopo:~$.


FREE YOUR MIND AND YOUR PASS(WORD) WILL FOLLOW

ssh-keygen
When I’m working with a C.H.I.P. remotely, it gets irritating to constantly enter my password, especially if it’s a long, weird, secure password. I also like to sometimes run things like an automated update to several computers at once with rsync, and I don’t want to have to enter in a password. Good thing there’s a cure for my ill!

In Linux or OS X, open a terminal and generate an SSH keypair:
ssh-keygen -t rsa

Hit return for all questions, do not enter a password when asked.


Moving On…

Copy this key to C.H.I.P.’s root directory with scp:
scp ~/.ssh/id_rsa.pub chip@totopo.local:~/

Login to C.H.I.P.:
ssh chip@totopo.local
and enter your password to login.

Note: If you haven’t setup zeroconfig — that’s what enables you to use .local addresses — check out out the docs for instructions.

You may need to create a .ssh directory on C.H.I.P.:
mkdir .ssh

Now add the public key from your computer to C.H.I.P.’s log of authorized keys:
cat id_rsa.pub >> .ssh/authorized_keys && rm id_rsa.pub

Finally, you have to set up your permissions on C.H.I.P. so this key can be accessed when you try to log in:
chmod go-w ~ && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys


Windows Does It Differently

For Windows, the process is more involved, since the OS does not have built-in support for generating a key. If you are using PuTTY, a free SSH client, and don’t have PuTTYgen already, you can download it here.

Launch the program, and then click the Generate button. The program generates the keys for you. Hit return for all questions, do not enter a password when asked.

Save the key by clicking the ‘Save Private key’ to a file named “id_rsa.pub” to PuTTY’s keys folder (this is setup in PuTTY’s configuration panel in Connection/SSH/Auth). You will need to copy this file to C.H.I.P. with pscp (PuTTY scp). If you are using the Chrome terminal emulator Secure Shell or cygwin for your Windows terminal needs, the process is more or less the same as it is for Linux and Mac


YOU DID IT!

Your C.H.I.P. is now secure and even easier to use!

Got more security questions or solutions? Head over to the forums to ask and share with the community!

]]>
NTC Project: Upcycle Your Old Speakers with C.H.I.P. https://ntcblogbackup.wpengine.com/ntc-project-upcycle-your-old-speakers-with-c-h-i-p/ https://ntcblogbackup.wpengine.com/ntc-project-upcycle-your-old-speakers-with-c-h-i-p/#comments Tue, 01 Mar 2016 16:00:47 +0000 http://blog.nextthing.co/?p=128 infull

Upcycled speakers with C.H.I.P., a new amp, hard drive, and LiPo battery

I recently acquired a really handsome pair of speakers. The cabinets are made of a gorgeous solid walnut exterior, and have an ideal size that Goldilocks could only dream. You simply don’t find speakers that look this good anymore: veneer, plastics, and MDF rule the day when it comes to speaker materials.

header_handsome

There was one essential problem: they just didn’t sound very good. Equipped with 40+ year-old drivers, they lacked good definition and decent high end. As a remedy, I paid a visit to parts-express and used some of their great tools to find speakers that would fit the existing cutouts (more or less), be appropriate for the size of sealed cabinet, and find a crossover that would match the drivers.

(The crossover provides filtering for the drivers so they only reproduce sound that is appropriate for each speaker. There’s not much point in feeding the woofer high-frequency sound, and vice-versa for the tweeter.)

wood

Solid walnut speakers ╭( ・ㅂ・)و

The other problem with these speakers is that I already have plenty of speakers. Too many, really. I needed a good reason to dig in and rebuild these beauties.

Enter C.H.I.P. and the software package music player daemon (mpd). Paired with a small amplifier to power the speakers and a spare 500GB hard drive, C.H.I.P. and mpd serve as the brains of the operation to manage files and playback music. After a few hours of work, I ended up with a great-looking, self-contained music system that can play a huge collection of songs. Here’s what I did.

Materials!

The list below has some flexibility in it, of course. I have a LiPo battery for C.H.I.P. so I didn’t need the powered hub. You can also avoid using a hub if you use a USB thumb drive or some other storage that requires less power than a spinning disc.

  • C.H.I.P. computer
  • LiPo Battery
  • Two handsome stereo speakers
  • Low and high frequency drivers, a pair of crossovers, and a small amplifier*
  • TRRS-to-RCA cable
  • USB hard drive
  • Powered USB hub (if hard drive enclosure does not have a power supply)
  • USB cables
  • WiFi Connection
  • Speaker Wire
  • Gloves and a mask are recommended for this project

*If you must know, here’s what I bought:

  • Speaker Crossover 2-Way 8 Ohm 5,000 Hz 150W Part # 260-198
  • Tymphany TC9FD18-08 3-1/2″ Full Range Paper Cone Woofer Part # 264-1062
  • GRS 8FR-8 Full-Range 8″ Speaker Pioneer Type B20FU20-51FW Part # 292-430<
  • Lepai LP-269FS 4x45W Mini Amplifier with Remote USB MP3 Media Card FM Part # 310-304

Rebuild

working

First, I had to remove all the old components and install the new ones. This didn’t require much more than a bit of work with a driver and a drill. I had to be careful with the baffling – old fiberglass will make your skin itch quickly, and the dust is pretty nasty!

safety

And that’s why we have the “SAFETY!” drawer in the NTC shop.

Once the new drivers were in, wired up, and tested to work, I sealed up the cabinet, and even grabbed a nearby caulking gun to keep everything tight around the edges. The only air I want moving is what the drivers push around!


Sound

backback_connections

Testing the placement of components on the rear of the speaker

The Lepai amplifier is really quite cool. This model can drive up to 4 speakers, and is designed for people wanting to beef up systems in boats, cars, RVs, and motorcycles. It’s small, and has mounting wings to lock it down with screws. It also has an FM tuner and can read music from USB sticks and SD cards. This makes it easy to test the amp and speakers to make sure everything is working correctly.


C.H.I.P.

I suppose many people would stop there: pop in a USB stick full of music and press play!

But my music collection is larger than the biggest SD and USB storage devices, and I wanted the ability to create playlists and control this thing from anywhere in WiFi range. C.H.I.P. to the rescue!

Not only was this incredibly easy to get running, it works great. I even went the extra step of re-flashing C.H.I.P. with a version of Debian with no desktop manager or windowing environment. Since all this C.H.I.P. does is play music and serve up an interface on the web, I don’t need a GUI to get around.

1. (Optional) Keep C.H.I.P. Simple

How? Simply flash C.H.I.P. with a Debian, no GUI image. Just follow the instructions in our docs using Option 2: Flash with Debian.

Simple” here, of course relates to what C.H.I.P. has to do, not you. This step actually makes things slightly more complicated for you! However, most of the work for this is going to use the terminal, so it’s really a very slight difference.


2. Get On-board

If you skipped step one, you can hook up C.H.I.P. to a network like you would any other computer.

If you did step one, you’ll need to get on a network using the command-line network tool nmcli. You can connect C.H.I.P. to a computer’s USB port, and setup the network using a serial terminal, or you can hook up a monitor and keyboard to type commands on C.H.I.P.

Once you have a command line prompt, here the short version of how to connect with nmcli is:
sudo nmcli d wifi connect networkname password wifipassword ifname wlan0

You’re smart, so it’s probably obvious that you should put in your wifi network name for networkname and your password for wifipassword. But, for posterity’s sake, I’ll mention that. Just in case 🙂

Note: If you need more info about nmcli, check our documentation.


3. Make C.H.I.P. Do Music Things

mpd

For that, you’ll install the program mpd. It’s as simple as the name (which stands for “music player daemon.”).

To install mpd, in the terminal, enter the line below to update your package installer then install mpd:
sudo apt-get update && sudo apt-get install mpd

By default, mpd will look for music files in /var/lib/mpd. If you don’t want to add a drive to C.H.I.P., you can just add music to that directory and start playing with an mpd client (more on that later).

Note: You can learn a lot about mpd on the internet.

In short, the way mpd works is that it uses C.H.I.P. to play and organize music, but if you want to control it at all (like press play), you’ll need a client software of some sort.

What’s cool is that clients can run on C.H.I.P., your phone, tablet, or another computer, giving you instant access.


battery_no

C.H.I.P. wired to my hard drive and powered USB hub

4. Add A Storage Unit.

I used a small hard drive leftover from various laptop upgrades. It’s 500GB, housed in an inexpensive USB case, and perfect for holding my music. C.H.I.P. needs a bit more power for the drive to operate, which can be achieved either by adding a battery to C.H.I.P. or a powered USB hub.

I like the battery option because it provides a power backup in case of outage and reduces the wire count.

battery_with

Cable management is easy, at least for this project

Once the drive is hooked up, C.H.I.P. needs to be told where the drive is and how to deal with it. Back to the terminal!

While our documentation covers this topic, it’s worth condensing into this post:

Connect the drive to C.H.I.P.’s USB and use the command below to list all the attached devices.
ls /dev/sd*
You’ll most likely see.
/dev/sda1
This is the name of your drive, as far as the operating system is concerned.

Now that you know the drive name, create a directory that will serve as a mounting point for /dev/sda1.
sudo mkdir /drives

Give mpd permission to access file in the directory you just created.
sudo chmod -R 777 /drives

Next, mount the /dev/sda1 with the mounting point /drives.
sudo mount /dev/sda1 /drives

Finally, you’ll want this drive to mount when C.H.I.P. boots up. Edit the /etc/fstab and enter the information to properly mount /dev/sda1.

Note: Fstab is short for the file system table.
sudo nano /etc/fstab

Add the line below to the /etc/fstab.
/dev/sda1 /drives vfat defaults 0 0

Save your change and at the command line, make sure all is good with fstab by running sudo mount -a. If no errors are produced, your setup is good to go.


5. Make It Work

Now it’s time to configure mpd. First, create a playlist directory on the hard drive.
mkdir /media/Music/playlists

Open up the mpd configuration file in a text editor.
sudo nano /etc/mpd.conf

Find the lines for music_directory and playlist_directory, and change them so they look like the lines below.
music_directory "/drives/music"
playlist_directory "/drives/playlists"

Note: ctl-w in nano makes it easy to find strings!

Of course, I’m assuming that you have all your music in a music folder on your /drive. Change as needed!

Now sudo reboot C.H.I.P. and move on to the next step.


6. Get Some Clients.

Not because you’re a lawyer fresh out of school, but because you need to play some music out of C.H.I.P. on some totally rad (not to mention handsome) speakers! There are a ton of clients available. I have an iPhone, and I use MPoD, which works well.
mpod_use

Note: I have been filling up my drive with music on my Mac. When I reconnected the drive to C.H.I.P. and tried to play the new music from MPoD, I had to go to the Settings and first select “Update Database” to tell C.H.I.P. to get to work, then “Refresh local cache” to get all the new listings on my phone.

At this point you should be good to go with C.H.I.P., mpd, and your upcycled speaker!


7. Going Further
But don’t stop here, what other cool things can you do now? You could add an external sound card to improve sound quality, you could setup icecast with mpd to make your own network radio, you could install Samba or AFP for network access to the files, or even just use SFTP with an FTP client and access your music files that way. Here’s a few resources that might help you out.

infull

For more C.H.I.P. specific projects, check out


]]>
https://ntcblogbackup.wpengine.com/ntc-project-upcycle-your-old-speakers-with-c-h-i-p/feed/ 6