3D Printing
I have been busy on many projects lately and did not have time to report anything.
Today, I share the first power on and printing test of my new 3D printer.
I had the idea for a while to make a sla 3D printer using UV led and LCD screen mask. While browsing the net, I found this printer at very reasonable price. I decided to buy one. The machine is from Micromake. Micromake L1.
The printer arrived well packed. The kit included the machine, power supply, 500 ml of resin.
It runs with Creation Workshop and photonic3d. I used for the first test Creation Workshop.
The connection and setting is fairly easy. Nothing special. Install a driver if necessary. Set the second screen on the main system and voila.
I had to run 5 tests before getting something okay. All 4 first tests, the printing was not sticking to the base. I just randomly increased the UV curing time and the 5th test shape was just fine.
Some photos…
Last printing…
Conclusion: Good surprised, it just works fine.
dweet.io – Simple Android application
I discovered a bit late this nice and simple messaging for iot. dweet.io
Here is a simple application developed with AI2 to read your latest dweet…
The app is simple, but can be used to go further into development like getting some reading, alarms…
Enjoy…
Arcade Game
I haven’t finished my pinball yet and then looking at other things… While browsing, I came across this nice cabinet and decided to get one. It looks nice and well done.
At the same time I purchased a Pandora’s box 680 in 1. (Jamma Box)
Result in few days…
I bought the cabinet from this shop in China. Only delivery in China.
…
Artnet, WS2812 and ESP8266 (Arduino IDE)
From my previous post I have updated the program to be compiled from Arduino IDE.
#include <ESP8266WiFi.h> #include <WiFiUdp.h> #include <Adafruit_NeoPixel.h> #define WSout 5 // Pin D1 #define ARTNET_PORT 6454 #define PIXELCOUNT 100 byte hData[318]; const int number_of_channels=300; //512 for 512 channels const char* ssid = ""; const char* password = ""; Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXELCOUNT,WSout,NEO_GRB+NEO_KHZ800); WiFiUDP udp; IPAddress local_ip(192, 168, 1, 190); IPAddress gateway_ip(192, 168, 1, 1); IPAddress subnet_ip(255, 255, 255, 0); void setup() { Serial.begin(115200); delay(100); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); WiFi.config(local_ip, gateway_ip, subnet_ip); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } udp.begin(ARTNET_PORT); // Open ArtNet port Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); pixels.begin(); for(byte i=0;i<PIXELCOUNT;i++){ pixels.setPixelColor(i, Color(0,0,0)); } pixels.show(); } void loop() { if (udp.parsePacket()) { udp.read(hData, 318); // pixels.setPixelColor(0, Color(hData[19], hData[20],hData[21])); for ( int n=0; n<100; n++){ pixels.setPixelColor(n, Color(hData[(n * 3) + 19], hData[(n *3)+20],hData[(n *3)+21])); } pixels.show(); } } uint32_t Color(byte r, byte g, byte b){ uint32_t c; c = r; c <<=8; c |= g; c <<= 8; c |= b; return c; }
The WS2812 data line is connected to D1 from the NODEMCU board.
Config of the Arduino IDE
It looks like it work better than the code in Lua.
This comes from a similar program I did few years ago to run 10 matrices of 10 x 10 pixels. I was using WS2801 led stripes, arduino UNO and ethernet shield.
Everything still runs smooth untill now.
Some photos of matrix installed and the controller running JINX.
Artnet, WS2812 and ESP8266 (Lua)
From my previous post on Artnet ESP8266, I had some feedback about some trouble. I decided to make it again but with the WS2812.
- Flash the ESP8266 with the correct library. You will need:
- Nodemcu flasher
- Esplorer
- Compile a new firmware using: Nodemcu Custom Builds
Once compiled you will receive an email with a link to download the firmware.
Upload the firmware with Nodemcu flasher and change the path to point to the custom firmware
With Esplorer, upload this program:
wifi.setmode(wifi.STATION) wifi.sta.config("*****","*****",1) tmr.delay(5000000) -- wait 1,000,000 us = 1 second print(wifi.sta.getip()) print("Running") gpio.mode(4, gpio.OUTPUT) ws2812.init() tmr.delay(1000000) ws2812.write(string.char(0,0,0):rep(100)) s=net.createServer(net.UDP) s:on("receive",function(s,c) ws2812.write(string.sub (c, 19, 318)) end) s:listen(6454)
I am driving a Matrix (10*10) of 100 pixels.
In the UDP loop, I am extracting the 300 bytes (19 to 318) corresponding to each RGB values of each pixels; 3 * 100. Bytes 1 to 18 are the Artnet header.
The led stripe is connected to PIN D4 of my NODEMCU Board
Forgot to mention that a fast wifi router is needed.
Enjoy…
ESP8266+18650
The other day I came across this nice stuff; A board with an ESP8266, a battery 18650 holder and a charging circuit. Really cool stuff.
I bought a couple of them.
I flashed it using the nice firmware ESPURNA. The firmware is a great piece of code. Thanks for that. GrĆ cies Xose.
An interesting thing about ESPURNA is about the way the web UI was compiled.
To install the libraries necessary to compile the code, please follow the wiki from the site. It is very explicit.
A screenshot of the Arduino IDE config folr the board
It has been running a couple of days now and everything is smooth. Need to test the sleep mode because the battery is not lasting long, about 15 hours. Charging cycles are OK too.
Nice board.
Android – Photo loader
I needed a quick and easy way to upload photos taken from my phone to a webserver without having to use cable, ftp transfer… (mainly for my job)
While browsing the App Inventor I found an application called photo booth and it gave me some ideas.
I modified a bit the app and used a php script to save the photos to the folder I want on my server.
The aia file for App Inventor 2.
To use it:
- Install the apk
- Copy the php script into your server
- Modify the php script. Change the folder name and location where you want to upload the photos
- In the phone application, there are 2 text fields. One for the ip address and folder location of the php script. One for the photo name
Enjoy.
Source Code Beautifier
I found that the other day and love it. It helps to nicely display code or whatever in blog posts.
Enjoy.
Arduino: collect2.exe: error: ld returned 5 exit status
I spent hours to try to find a solution to fix this error at compilation.
My code don’t have any problem, just the things showed up after upgrading arduino (win XP).
What I did at the end was to add dummy variable to the code and it worked. Try to add 1, 2, 3 , 4 and it worked!!
Example:
byte y1 = 0; byte y2 =0; byte y3 =0; byte y4=0;
good luck!
Pinball
A project that I have started few months ago.
Basically, everything is working. Using Pinball fx2 for the games.
Time to keep up with the project… It has been sleeping forĀ while.
What’s coming next:
Backglass with DMD and screen for image. Nudge control with accelerometer (basic setting). A bit of lighting…
DMD: Setting of Pin2Dmd.
I use a STM32F4 discovery board, P4 1/16 led matrix (cheaper than P2.5). I spent about a day to make this working; I could not get the board working with the last firmware (2.42). The communication with the PC was not responding. I then downgraded to 2.38 and all was fine excepted an image not sharp (kind of glitching or ghosting). I found out that I needed a bit more of 3.3 V to control the P4 because of the bus-driver of the P4, 74HC245, the HC version requires more than the HCT version. This is something that I will add on shield board for final connection. I decreased the supply of the P4 of few mV (final supply 4.7V).
Everything works fine now. I just need to register to get a key from PIN2DMD.
Next, a bit of light show for the backglass. To make the thing simple, I tested something like Ambilight. It extends the sides color of the screen to led stripes. Simple and okay to make some animation. For testing, I used the software AMBIBOX (direct download) and the following arduino code (need FastLED Library)
#include "FastLED.h" #define NUM_LEDS 24 #define DATA_PIN 3 #define serialRate 115200 static const uint8_t prefix[] = {'A', 'd', 'a'}; // Define the array of leds CRGB leds[NUM_LEDS]; void setup() { FastLED.addLeds<WS2811, DATA_PIN, RBG>(leds, NUM_LEDS); Serial.begin(serialRate); Serial.print("Ada\n"); } void loop() { for (int i = 0; i < sizeof(prefix); ++i) { while (!Serial.available()); if (prefix[i] != Serial.read()) return; } while (Serial.available() < 3); int highByte = Serial.read(); int lowByte = Serial.read(); int checksum = Serial.read(); if (checksum != (highByte ^ lowByte ^ 0x55)) { return; } uint16_t ledCount = ((highByte & 0x00FF) << 8 | (lowByte & 0x00FF) ) + 1; if (ledCount > NUM_LEDS) { ledCount = NUM_LEDS; } for (int i = 0; i < ledCount; i++) { while (Serial.available() < 3); leds[i].r = Serial.read(); leds[i].g = Serial.read(); leds[i].b = Serial.read(); } FastLED.show(); }
Nudge control:
I use my previous Arduino due arcade control and added a bit of code for the accelerometer (ADXL345) reading. It is in testing now not 100% okay.
#include #include #include #include //change debounce time to 1ms //will add led control #define DEBOUNCE 1 // how many ms to debounce //define the buttons that we'll use. byte buttons[] = {22, 23, 24, 25, 26, 27, 28, 29}; byte out[] = {44, 45}; byte key[] = {129, 133, 176, 218, 217, 216, 215, 177}; //left shift, right shift, return, Up Arrow, Down Arrow, Left Arrow, Right Arrow, Esc //128 left ctrl //132 right ctrl //32 space // need to add up down left right esc //determine how big the array up above is, by checking the size #define NUMBUTTONS sizeof(buttons) #define NUMOUTS sizeof(out) //track if a button is just pressed, just released, or 'currently pressed' byte pressed[NUMBUTTONS], justpressed[NUMBUTTONS], justreleased[NUMBUTTONS]; byte previous_keystate[NUMBUTTONS], current_keystate[NUMBUTTONS]; float x_before; float y_before; Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); void setup() { byte i; /* Initialize the sensor */ if (!accel.begin()) { while (1); } Keyboard.begin(); for (i = 0; i < NUMBUTTONS; i++) { pinMode(buttons[i], INPUT); digitalWrite(buttons[i], HIGH); } for (i = 0; i < NUMOUTS; i++) { pinMode(out[i], OUTPUT); digitalWrite(out[i], LOW); } accel.setRange(ADXL345_RANGE_2_G); accel.setDataRate(ADXL345_DATARATE_3200_HZ); sensors_event_t event; accel.getEvent(&event); x_before = event.acceleration.x; y_before = event.acceleration.y; } void loop() { float x_now, y_now; sensors_event_t event; accel.getEvent(&event); x_now = x_before - event.acceleration.x; y_now = y_before - event.acceleration.y; if (abs(x_now) > abs(y_now)) { if ((x_now) > 1.5) { Keyboard.press(32); delay(50); Keyboard.release(32); } } else { if ((y_now) > 2) { Keyboard.press(128); delay(50); Keyboard.release(128); } if ((y_now) < -2) { Keyboard.press(132); delay(50); Keyboard.release(132); } } check_switches(); for (byte i = 0; i < NUMBUTTONS; i++) { if (justpressed[i]) { Keyboard.press(key[i]); } if (justreleased[i]) { Keyboard.release(key[i]); } } } void check_switches() { static byte previousstate[NUMBUTTONS]; static byte currentstate[NUMBUTTONS]; static long lasttime; byte index; if (millis() < lasttime) { // we wrapped around, lets just try again lasttime = millis(); } if ((lasttime + DEBOUNCE) > millis()) { // not enough time has passed to debounce return; } // ok we have waited DEBOUNCE milliseconds, lets reset the timer lasttime = millis(); for (index = 0; index < NUMBUTTONS; index++) { justpressed[index] = 0; //when we start, we clear out the "just" indicators justreleased[index] = 0; currentstate[index] = digitalRead(buttons[index]); //read the button if (currentstate[index] == previousstate[index]) { if ((pressed[index] == LOW) && (currentstate[index] == LOW)) { // just pressed justpressed[index] = 1; } else if ((pressed[index] == HIGH) && (currentstate[index] == HIGH)) { justreleased[index] = 1; // just released } pressed[index] = !currentstate[index]; //remember, digital HIGH means NOT pressed } previousstate[index] = currentstate[index]; //keep a running tally of the buttons } }
Backglass work in progress.