Better 3D Graphics On The Arduino

There are cheap LCDs available from China, and when plugged into an Arduino, these displays serve as useful interfaces or even shinier baubles for your latest project. [Michael] picked up a few of these displays in the hope of putting a few animated .GIFs on them. This is an impossible task with an ATMega microcontroller – the Arduino does not have the RAM or the processing power to play full-screen animations. It is possible to display 3D vector graphics, with an updated graphics library [Michael] wrote.

The display in question uses the ILI9341 LCD driver, found in the Adafruit library, and an optimized 3D graphics driver. Both of these drivers have noticeable flicker when the animation updates, caused by the delay between erasing a previous frame and when a new frame is drawn.

With 16-bit color and a resolution of 320×240 pixels, there simply isn’t enough memory or the processing power on an ATMega microcontroller to render anything in the time it takes to display a single frame. There isn’t enough memory to render off-screen, either. To solve this problem, [Michael] built his render library to only render pixels that are different from the previous frame.

Rendering in 3D presents its own problems, with convex surfaces that can overlap themselves. To fix this, [Michael]’s library renders objects from front to back – if the pixel doesn’t change, it doesn’t need to be rendered. This automatically handles occlusions.

In a demo application, [Michael]’s LCD and Arduino can display the Stanford bunny, a low-poly 3D face, and geometric object. It’s not a video game yet, but [Michael] thinks he can port the classic game Spectre to this platform and have it run at a decent frame rate.

Video of the demo below.

Continue reading “Better 3D Graphics On The Arduino”

Code Craft-Embedding C++: Hacking The Arduino Software Environment

The Arduino software environment, including the IDE, libraries, and general approach, are geared toward education. It’s meant as a way to introduce embedded development to newbies. This is a great concept but it falls short when more serious development or more advanced education is required. I keep wrestling with how to address this. One way is by using Eclipse with the Arduino Plug-in. That provides a professional development environment, at least.

The code base for the Arduino is another frustration. Bluntly, the use of setup() and loop() with main() being hidden really bugs me. The mixture of C and C++ in libraries and examples is another irritation. There is enough C++ being used that it makes sense it should be the standard. Plus a good portion of the library code could be a lot better. At this point fixing this would be a monumental task requiring many dedicated developers to do the rewrite. But there are a some things that can be done so let’s see a couple possibilities and how they would be used.

Continue reading “Code Craft-Embedding C++: Hacking The Arduino Software Environment”

Simone Does Strange Things With Motors And Servos

If DC motors are the “Hello World” of making things move, servo motors are the next logical step. [Simone Giertz] is following this exact path with the Wake-up Machine and her newly released Chopping Machine. [Simone] discovered that the best way to wake up in the morning is to be repeatedly slapped in the face by a robot. The Wake-up Machine was custom designed to do exactly that. Who could sleep through being repeatedly slapped in the face? A beefy gearmotor from ServoCity spins a Halloween prop arm round and round, providing  “refreshing” slaps.

wakeThe system is triggered by an alarm clock. The clock’s alarm output is connected to an Arduino Uno. The Uno then activates a relay, which spins up the motor. [Simone] realizes that she could have skipped the Arduino here, but it was the path of least resistance in for this project. If the slapping hand isn’t enough to get you going, the Wake-up machine does have a secret weapon: It may just grab your hair, turning a video shoot into a painful ordeal.

Simone’s latest project is the Chopping Machine. ServoCity must have liked her first videos, as they’ve sponsored her for this project. The machine consists of two knives that … well, chop. Two high-powered servos are controlled by an Arduino Nano. The servos raise spring-loaded knives, which then drop down, chopping vegetables, fingers, and anything else in their path. The whole machine is built with aluminum channel stock, and a huge wooden cutting board. Of course, just building the machine wasn’t enough. [Simone] filmed a parody infomercial for any perspective Chopping Machine buyers, and to put fear in the heart of anyone named Chad.

Click past the break for a couple of [Simone’s] vlogs describing the machines.

Continue reading “Simone Does Strange Things With Motors And Servos”

IoT Power Strip Lets You Control All Your Holiday Lights

As IoT devices become more prevalent in the consumer world, how long will it be before it’s cheaper to buy one, than to make one? Definitely not yet, which means if you want your very own IoT power strip — you’ll have to make your own. Good thing it’s not that hard!

[Dev-Lab] came up with this project which allows him to control several outlets with his phone. What we really like about it is that he designed a 3D printed housing that fits on the end of the power-strip. This keeps all messy wires out of sight, and it looks like it was designed to be there!

The beauty with an IoT device like this is that it doesn’t require any infrastructure besides a WiFi enabled device with an HTTP browser — the ESP8266 module means no server is necessary. An Arduino was used in the project just because it was quick an easy to do. But it really boils down to being a glorified pin expander. This could very easily be fixed by upgrading from an ESP01 to and ESP03 module to get more IO broken out on the carrier board. If you do this, let us know!

Continue reading “IoT Power Strip Lets You Control All Your Holiday Lights”

$20 Sip-and-Puff Mouse From E-Cig And 3D Printing

At Hackaday, we think the highest form of hacking is hacking for good. Sure, it’s fun to build robots and gadgets, and universal remotes. But it is even better to create things that make people’s lives better. In that spirit, we enjoyed seeing the Assistive Tech Challenge over on Thingiverse that ended last month. The winner was [0_o] who used 3D printing and an Arduino to produce a mouth-operated mouse for under $20.

sip-sensor-from-ecigInstructions on Thingiverse can be spotty, but [0_o] did an excellent job of laying out what you need to buy and how to assemble it. One of the most interesting parts of the build is the blow sensor. [0_o] tore apart a $5 electronic cigarette and used the sensor within. The mouthpiece is moved like a joystick to actuate the cursor, and the user blows into it for the mouse clicks. Perhaps not a true sip-and-puff system but it made us wonder what other uses you might find for these sensors.

You can see a video about the mouse after the break. These kinds of projects have the power to make someone’s life better and what could be better than that?

Continue reading “$20 Sip-and-Puff Mouse From E-Cig And 3D Printing”

Reading Smart Cards From A PLC (with A Little Arduino Help)

If you’ve spent any time on a factory or plant floor, it is a good bet you’ve run into PLCs (Programmable Logic Controllers). These are rugged computers that do simple control and monitoring functions, usually using ladder logic to set their programs. [plc4u] wanted to connect a smart card reader to an Allen Bradley PLC, so he turned to an Arduino to act as a go-between.

The Arduino talks to a USB card reader using a USB host shield. Then it communicates with the PLC using an RS232 link and the DF1 protocol that most Allen Bradley PLCs understand. You may not need a smart card, but once you know how to communicate between an Arduino and the PLC, you could do many different projects that leverage other I/O devices and code available on the Arduino and connects to existing PLC installations. Just remember that you’ll probably need to ruggedize the Arduino a bit to survive and be safe to the same level as a PLC (which might include a NEMA enclosure or even an explosion-proof box).

Continue reading “Reading Smart Cards From A PLC (with A Little Arduino Help)”

Code Craft – Embedding C++: Templates

The language C++ is big. There is no doubting that. One reason C++ is big is to allow flexibility in the technique used to solve a problem. If you have a really small system you can stick to procedural code encapsulated by classes. A project with a number of similar but slightly different entities might be best addressed through inheritance and polymorphism.

A third technique is using generics, which are implemented in C++ using templates. Templates have some similarities with #define macros but they are a great deal safer. The compiler does not see the code inserted by a macro until after it has been inserted into the source. If the code is bad the error messages can be very confusing since all the developer sees is the macro name. A template is checked for basic syntax errors by the compiler when it is first seen, and again later when the code is instantiated. That first step eliminates a lot of confusion since error messages appear at the location of the problem.

Continue reading “Code Craft – Embedding C++: Templates”