Posts with «arduino» label

Debugging an Arduino with an Arduino

As every Hackaday reader knows, and tells us at every opportunity in the comments, adding an Arduino to your project instantly makes it twice as cool. But what if, in the course of adding an Arduino to your project, you run into a problem and need to debug the code? What if you could use a second Arduino to debug the first? That would bring your project up to two Arduinos, instantly making it four times as awesome as before you started! Who could say no to such exponential gains?

Debugging an ATTiny85

Not [Wayne Holder], that’s for sure. He writes in to let us know about a project he’s been working on for a while that allows you to debug the execution of code on an Arduino with a second Arduino. In fact, the target chip could even be another AVR series microcontroller such as a the ATTiny85. With his software you can single-step through the code, view and modify values in memory, set breakpoints, and even disassemble the code. Not everything is working fully yet, but what he has so far is very impressive.

The trick is exploiting a feature known as “debugWIRE” that’s included in many AVR microcontrollers. Unfortunately documentation on this feature is hard to come by, but with some work [Wayne] has managed to figure out how most of it works and create an Arduino Sketch that lets the user interact with the target chip using a simple menu system over the serial monitor, similar to the Bus Pirate.

[Wayne] goes into plenty of detail on his site and in the video included after the break, showing many of the functions he’s got working so far in his software against an ATTiny85. If you spend a lot of time working on AVR projects, this looks like something you might want to keep installed on an Arduino in your tool bag for the future.

Debugging microcontroller projects can be a huge time saver when your code starts running on real hardware, but often takes some hacking to get working.

Arduino and processing based GUI person counter

In this post, we will make arduino and processing based GUI person counter. For person counter, we are using infrared sensor (IR). It's output is digital and is fed to pin number 7 of arduino.

The connections are as follows:


Arduino Code:

int switchPin=7;
int ledPin=13;

void setup() {
pinMode(switchPin,INPUT);
digitalWrite(switchPin,HIGH);
pinMode(ledPin,OUTPUT);
Serial.begin(9600);
}

void loop() {
  if(digitalRead(switchPin))
    {
    while(digitalRead(switchPin));        
    Serial.print(1,DEC);
    }
  else
    {
    Serial.print(0,DEC);
    }
    delay(100);
} 

Processing Code:

import processing.serial.*;

Serial port;
int val;
int count=0;
PFont f;                           // STEP 1 Declare PFont variable

void setup()  {
    size(400,400);
    noStroke();
    println(Serial.list());  // print list of available serial port 
    port=new Serial(this,Serial.list()[0],9600);        
    f = createFont("Arial",16,true); // STEP 2 Create Font
 }
  
void draw()  {
  if(0<port.available())
  {
    val=port.read();
  } 
    background(204);
    println(val);

  if(val==48)
{     fill(255,0,0);   // red
  rect(50,50,300,300);  // green
}
  else if(val==49)
{     fill(0,255,0);   // green
  rect(50,50,300,300);  // green
  count++;
}

  textFont(f,30);               
  fill(0);                         
  text("Number of Person is: " + count , 30, 30);
//text(count, 100, 100);
delay(100);

 }

/* END OF CODE */

The Via Libris is a Book that Leads You to Treasure

The VIA LIBRIS is a paperback-sized book that leads its user to a predetermined location using a special compass dial and clues.

Read more on MAKE

The post The Via Libris is a Book that Leads You to Treasure appeared first on Make: DIY Projects and Ideas for Makers.

Circuit Bent Casio SK-1 gets an Arduino Brain

The Casio SK-1 keyboard is fairly well-known in the “circuit bending” scene, where its simple internals lend themselves to modifications and tweaks to adjust the device’s output in all sorts of interesting ways. But creating music via circuit bending the SK-1 can be tedious, as it boils down to fiddling with the internals blindly until it sounds cool. [Nick Price] wanted to do something a bit more scientific, and decided to try replacing his SK-1’s ROM with an Arduino so he could take complete control it.

Replacing the ROM chip with header pins.

That’s the idea, anyway. Right now he’s gotten as far as dumping the ROM and getting the Arduino hooked up in place of it. Unfortunately the resulting sound conjures up mental images of a 56K modem being cooked in a microwave. Clearly [Nick] still has some work ahead of him.

For now though, the progress is fascinating enough. He was able to pull the original NEC 23C256 chip out of the keyboard and read its contents using an Arduino and some code he cooked up, and he’s even put the dump online for any other SK-1 hackers out there. He then wrote some new code for the Arduino to spit data from the ROM dump back to the keyboard when requested. In theory, it should sound the same as before, but with the added ability to “forge” the data going back to the keyboard to make new sounds.

The result is what you hear in the video linked after the break. Not exactly what [Nick] had in mind. After some snooping with the logic analyzer, he believes the issue is that the Arduino can’t respond as fast as the original NEC chip did. He’s now got an NVRAM chip on order to replace the original NEC chip; the idea is that he can still use the Arduino to reprogram the NVRAM chip when he wants to play around with the sound.

We’ve covered some pretty fancy circuit bent instruments here in the past, but if you’re looking for something a bit easier to get your feet wet we ran a start-to-finish guide back in the Ye Olden Days of 2011 which should be helpful.

Automated IC testing with Arduino Mega

Arduino boards by themselves are, of course, great for making a wide array of projects. Sometimes, however, you’ll need to add other integrated circuits (ICs) for extra functionality. If you want to be absolutely sure that the IC you’re using in your project is working correctly, this tester by Akshay Baweja will input the signals to the device, and analyze the outputs that it produces on a 2.4” touchscreen.

While this type of equipment would normally be quite expensive, Baweja’s Arduino Mega-powered gadget can be built for around $25.

I designed a shield for all components to fit-in and chose the Arduino Mega as my microcontroller board since both the ZIF Socket and LCD can be put side by side giving the build a compact and portable look and feel.

Be sure to check it out being demonstrated below, and if you want to create your own, code can be found on GitHub.

I’ll Have a Beer With a Compliment Chaser

[Andrew MacPherson] found out that compliments, even insincere ones, make the recipients feel better. So, he put together a thermal printer and a hilariously large button with an Arduino and created a machine that prints compliments. And where best to put a machine that prints out compliments? The local bar, where else?

An Arduino Nano clone runs the show connected to a thermal printer. The Nano clone didn’t like the 9 volt power supply, so a buck converter was used to reduce the voltage down to 5 volts for the Nano, while the printer gets the full power. During initial trials, the printer was very slow to print and it took [Andrew] a while to adjust the parameters – after tweaking the speed as well as the heating time, he was able to get the printer working without burning the paper or taking forever to print.

Once the machine was working, it was time to add a button. A large, light-up button was connected and glued to the side of the printer. More glue was used (after some “modifications” to the printer chassis) to secure a barrel connector for the power adapter.

[Andrew] decided that since he’s down at his favorite bar quite a lot, he’d set it up there. The customers could push the button and receive a compliment while drowning their sorrows. He got a friend of his who’s a copywriter to come up with some nicely written compliments to print out. The printer was such a hit that the bartender sent [Andrew] a message on Facebook saying so. If you have a thermal printer lying around, you can use this tutorial to connect it to the internet, or, if you don’t have one, you can build your own.

Junk Build Printer Uses Pencil To Print

Sometimes, it is interesting to see what you can build from the bits that you have in your junk drawer. [Dr West] decided to build a printer with spare parts including a hard drive, a scanner base and an Arduino. The result is a rather cool printer that prints out the image using a pencil, tapping the image out one dot at a time. The software converts the image into an array, with 0 representing white and 1 representing black. The printer itself works a bit like an old-school CRT TV: the scanner array moves the printer along a horizontal line, then moves it vertically and along another horizontal line. It then triggers the hard drive actuator to create a mark on the paper if there is a 1 in the array at that point.

We’ve seen a few drawing printers before, but most use a plotter or CNC approach, where the motors move the pencil on an X-Y . This type of dot matrix printer (sometimes called a dotter) isn’t as efficient, but it’s a lot of fun and shows what can be achieved with  a few bits of junk and a some ingenuity.

Kid’s kitchen beeps with the help of an Arduino

While Roald Hendriks is quite pleased with the build quality of the IKEA DUKTIG play kitchen, it does lack one thing—the ability to say “beep.”

This feature was requested by his daughter, who for her third birthday wanted “a kitchen that says beep, just like mommie’s.” Not wanting to disappoint, he dutifully installed an Arduino, along with a real-time clock module, buttons, and a speaker to allow her to set the cooking time, and have it count down just like the adult equivalent.

The mods are extremely well done, and the buttons and time display on the front look like they were meant to be there. Hendriks even installed lighting inside the oven so she can see what she’s baking!

Check it out in the video below!

Arduino Blog 31 Jan 19:56

Rotary encoders and Arduino combine for awesome universal remote

In his latest hack, “Matlek” has come up with an entirely new take on the universal remote, using a pair of rotary encoders instead of an array of buttons to output up to 400 individual signals.

One 20-step encoder in his remote selects the device to be controlled, while the other picks the function, like changing the volume or channel.

Pressing down on a built-in button on the action selection encoder executes a command, while if it’s held down for long enough, it can be programmed via an IR receiver. An Arduino is used to control the gadget because of its small size, and the project expands on several helpful concepts like SD card usage and IR signaling.

Of course, the remote has an IR receiver to “absorb” the IR signals of the remotes you want to “clone”, and an IR LED to send them. These protocols are saved on a microSD card, therefore you can switch OFF the remote (and the Arduino board), it keeps the information concerning the signals on the microSD card. There are also 2 rotary encoders with 20 positions each, and that is how you can have 400 buttons. Each rotary encoder is also a pushbutton. There is a LED to inform whether the universal remote is receiving or sending IR signals. This device works on a Lithium Ion battery (18650 cell), so it is portable. And finally, there is a switch, so you can switch it ON and OFF.

Want to create one of your own? You can find out Matlek’s entire tutorial here.

Automatic guitar strumming with Arduino Uno and chopsticks

If you like to make music, but don’t consider yourself particularly talented, YouTuber Make It And Fake It has come up with an innovative solution.

Her device uses an Arduino Uno, along with a hobby servo motor to move a pair of chopsticks that holds the pick. This means that the guitar can literally strum itself, and thanks to a small control box, she can even select from one of three rhythm patterns.

If you’re wondering what this could be used for, the answer comes at 1:40 in the demonstration video, where Make It And Fake It is shown drinking tea, playing another instrument, and even texting her mom while still producing music from the guitar. Code for the build can be found on GitHub.