Showing posts with label wall-e. Show all posts
Showing posts with label wall-e. Show all posts

20 December 2020

Wall-E DIY Project with Wifi (Part 4)

 And here is a picture of the final assembly. I put the speaker back in place. I created an USB connection at the bottom of the case so I can power Wall-E that way but also for emergency programming in case the OTA (Over The Air) updates over WiFi should go wrong somehow. Then I won't have to open it up again for reprogramming. For the power I'm using a Raspberry Pi USB Power Supply with provides 5V at 2,5 Amp. I guess that should be more than enough. In the picture you can now also see the red LED I installed next to the Oled Display. That led is connected directly to an GPIO pin of the ESP12 only with a simple 220 ohm resistor in series you can see in the top right corner of the PCB. You can see the motor controller left on that and there is also a transistor on the PCB that takes care of powering the lights in the eyes of Wall-E connected to another GPIO pin of the ESP12.  

And here is a picture of the complete assembled Wall-E. I'm not 100% happy with the placement of the display but this is really the best I could get. The glue on the double sided tape was very strong and I didn't want risking damaging another display since they are quite expensive. But overall I'm happy with the outcome. After all it is just a gadget for ourselves in our gadget cabinet. It has been quite a project. I have been busy with it for almost a month. Not every day of course, but including waiting for parts. You can control it by pressing the button that I forgot to mention previously. That is also attached to a GPIO of the ESP12. That is why I ran low on GPIO ports. They display already takes up 5 as well. OK I will conclude this series with some video's showing what it can do. And by now I can also control these scenes over voice commands and triggered by home automation scenes over WiFi. I hope you enjoyed this series.



19 December 2020

Wall-E DIY Project with Wifi (Part 3)

After getting the display to work I started with the motors. In the left upper corner of the bread board you can see the motor controller I used. It is an L293D chip. It is basically a switch but you can control motor speed for a DC motor by using Pulse With Modulation (PWM). Basically switching on and off very fast. But I didn't use that at all. Only full on and off, but I had to move in two directions. The manufacturer of this Wall-E toy did something mechanically interesting. When the motor moves forward the head moves and when the motor runs backwards the arms move. With the L293D you can do this easily. You have a signal for direction and then it switches polarity for the power of the motor. I hooked the LD293 up with as less pins as possible since as you can see now I had to switch back to an ESP12 because I couldn't get the display driver stable on the ESP32 and I didn't want to spend a lot of time on figuring out why. So now I had the display working, the audio. Only thing left was the eyes and a led where I decided to go for single color in stead of  an RGB led. 

Then came the most complicated part. And I didn't really see that one coming. The display I bought was mounted on a small PCB. Between the display and the PCB is a very thing flat cable. I cut a small piece from the case so that I could stick the flat cable through that hole and stick the the display on the outside with thin double sided tape. But I couldn't reach in with my hand to attach the flat cable again and it was all very tight. After a couple of tries I got it, but then the display didn't work anymore :( I had put too much stress on the cable. So I killed the display :( I had to order a new one and bought a small flat cable extender in the process. After a week of waiting I could try again. This time I asked my girlfriend to help. And this time it worked :) So it did cost me an expensive display but I found a method to get it right.

After testing I concluded everything was OK for assembly. All electronics and software were tested. So I took a piece of universal development PCB with lots of holes and started soldering wires to it. This is a way to create a prototype PCB without actually designing and manufacturing a real PCB. I usually do this when I make something once. It is reliable and when you make a mistake it is easy to correct. So after assembling the PCB I tested everything again and it still worked. So time to assemble everything. More about that in the next part.




 

14 December 2020

Wall-E DIY Project with Wifi (Part 2)

And then the display arrived. Time for some tesing. I also switched to an ESP32, since it has more CPU power and more Inputs and Outputs. I got the display working over SPI, but the library that I used didn't seem to be very stable. So I tested it on the ESP12 again and that worked fine. Hmmm what to do. I do need quite some IO to control everything. I planned on using an RGB led and that already takes up 3 Output pins alone. But first I decided to focus on writing the software to control the display. For the code it actually doesn't matter if it runs on an ESP32 or ESP12 so I could decide about that later. So first thing I did was watch some scenes from the Wall-E movie to determine what actually needed to be on the display.

And that also meant digging up some math knowledge. I used to be very good at math in school, but it is amazing how quickly you forget that stuff when you never actually use it. But I did need it because there is a Sun symbol on Wall-E's display and I could not load a bitmap or anything so I had to draw it with lines. And then you need a circle to begin with and then some line originating from the center in certain set angles where the starting point is further on the line. On the right you see that bit of code. Good old Sine and Cosine calculations :) Doesn't that feel like high school again. I did have to fiddle a bit with the scale because the resolution of the display isn't that high (128x128) so sometimes some lines just didn't look nice. But after some experimenting with values I was satisfied with the end result. And could focus on the rest. Next challenge was the bar that shows Wall-E's battery percentage and some text of course.

And here is the result that I managed to get. I think it looked quite OK comparing it to shots from the movie and actually comparing it to the sticker that was on Wall-E's chest. Also the bar is done with math and consists of rectangles. I decided that it should actually work so I made a function that I can feed a percentage and it draws the bar accordingly. You have to draw black rectangles to make the yellow ones disappear again by the way. I could not make the text fit by the way with the default fonts included in the library. So I had to create a custom font for that. Luckily there was an online website where I could do that. Ok enough for now more in the next part.



13 December 2020

Wall-E DIY Project with Wifi (Part 1)

My girlfriend and myself love gadget like I stated before. We especially like robots as well and Wall-E is one of our favorites. I started looking for a nice decent size Wall-E on E-bay but in good condition they are very expensive. So I eventually bought a broken one also missing the remote control that normally comes with it. So when it arrived the first thing I did was taking it apart to see what I could do with it. First thing I removed was the battery compartment since I planned to put it in our gadgets cabinet and it doesn't have to drive around. It will get a fixed power supply.

So I started measuring what the electronics still did but that wasn't much unfortunately. So I decided to cut all the wires and take out the electronics board. Then I slowly started to apply a low voltage to all the parts and see what still worked. It turns our the motors were still working. It had a motor to drive the wheels, but I don't need that like I said. But there is a second motor that moves the head and arms and that was neat and I wanted to use that. Second thing I found out is that it has lights in the eyes that light up blue. That of course is very cool. It had a speaker and sound board, so that brought me the idea to use the same mp3 player board I used in HAL9000 and get some sound from the movie Wall-E. On the chest Wall-E had a fake light that I thought would be cool to replace by an actual red led and also there was a sticker on his chest to represent a display. I thought how cool would it be to replace this by an actual Oled display! So I started looking for one with RGB color and in the right size and I found one :)

So now I had a plan. Time for action. First I took another ESP12 that I had and attached the MP3 player to it. I spend some time to sample audio from the movie and put the MP3s on the player. Luckily so far I could mainly use the software I already made for HAL9000. And I also put in OTA updating since I already had to take HAL9000 down once to update the firmware. I also put that in there. OTA means I can now update the firmware of the ESP12 over WiFi without having to attach it to the USB port of my computer. That is very handy and cool :) So now I had to wait for the display to arrive and also find something to drive the motor and the eyes. Soon more in Part 2.