The skull was working great connected usb to the PC. But I wanted it to be wireless. Since I have an Adafruit CC3000 breakout board available, decided to stick it in. Also a few years ago I made my own Arduino compatible board, based on the usbasp project and got the inspiration from the metaboard. My board end up beein a 5cm x 5cm board with Atmega328p which can run Arduino code.
The overview of the Internet of Skull now is like this.
With this architecture the laptop is just another trigger mechanism similar to a phone. On my last post the laptops was used to send information directly to the Arduino board but now the skull is free to play around. The Skull is completely wireless and receives power via a usb. It is connected to the closest usb plug I could find at the desired location. We got wifi in the entire office so it can be moved around without problem.
At home the Skull worked really good, every now and then the mqtt libraries got disconnected from the server but I was able to reconnect via the code and everything was good. But when got into the office the skull got disconnected and failed to connect again. I didn't had much time during work hours to debug and fix the situation, so I went for a quick and dirty trick. Whenever the device got disconnected I just soft reset the Atmega, that makes the board to reset and re-connect to the wifi and mqtt service. After the soft reset all starts working again. This solution is far from pretty, mostly because the skull stop working for a while until the reset completes. Wifi connection and DHCP takes some time to complete and that is horrible for the user that wants to see the skull respond to its commands. But is better than unplug and plug back. Also it didn't took much time to "fix".
The software reset is a simple hack I found on Instructables. There are two ways, I went with the all software way.
Seems that if you define a pointer to a function in address 0 and issue a call to it it restarts the program, how would have thought?
Here is a snipped of the code
//declare reset function at address 0
void(* resetFunc) (void) = 0;
When the time comes, just call that function like any other.
resetFunc();
Here is a quick video of the circuit for the skull, wires everywhere but that is just the way it is suppose to be in "prototypes".
Update:
I did showed my project on Adafruit's Show and Tell, here is the link
"And that is what I have to say about that" - Forrest Gump
