Saturday, November 28, 2020

0000 0000 0100 1011

Not really electronics (or is it?)

A quick tour of the 3D printing bench this week, mainly for me so that I don't forget all of the twists and turns in making the tracking software/hardware and the photographing software/hardware work as expected and required.

1. The printer

I had been thinking about a 3D printer for a couple of years, for a couple of reasons. Firstly, I hate jumping in the car and driving 30 minutes to the nearest hardware store to grab some stupid piece of plastic that costs $7 to buy, but probably one hundredth of that price to manufacture. A waste of time and money!

Secondly, there have been some projects which I have shoe-horned into off the shelf boxes, but then I have had to modify/extend etc., because some cable or other wasn't quite fitting in the enclosure.

Finally, I saw PileOfStuff and his Creality Ender 3 V2 and the die was cast. My limited research had also pointed me towards this model, and so after negotiations with the Minister of Finance I was able to purchase the unit locally and then wait by the postbox for it's arrival. While I waited (a week or so) I consumed all manner of YouTube videos about how to unpack, setup and test the printer, before settling on this explanation which worked fine. The whole process from box to first print took around 2 hours which I thought was pretty reasonable.

One extra useful step was to download and have handy some gcode that assists with leveling the print bed. I did it manually a couple of times (thanks YouTube), but the code makes it so much easier, and semi-automatic.

The Minister of Finance demanded that the first print be all about plastic pigs, and so this was the test run result while I fiddled with all the settings in the learning process (and in the end only one pig trotter fell off - to be superglued back on with nobody the wiser).


A week or so and after a few prints I came to realise that the bed was having trouble maintaining consistent temperature in the basement workshop, mainly because it could be as low as 3 degrees Celsius down there even at this time of year, with the odd breeze when doors are opened.

Also the space is a bit dusty which is not great for electronics or servo motors. I had been covering up the printer with a big plastic rubbish bag when not in use, but in the end I placed an additional online order for a medium Creality enclosure, and although it turned out to be comically large it was of course suitable for the task.


2. The OctoPrint solution.

On cold nights after work I was becoming more reluctant to trudge down and check the printer, so I downloaded Armbian for an Orange Pi Zero that I had lurking about in a cupboard. 

Quite a few online gurus were adamant that this was a bad combination, and that I would need to buy a late model Raspberry Pi to have any success. But after following an excellent online tutorial I had the thing up and running and reporting back the progress (or otherwise) of the print.

Occasionally a print was "lost" and the printer would grind to a halt awaiting further instructions. It turns out that the mountain of concrete between the upstairs router and the puny antenna of the Orange Pi Zero could be the weakest link.

In response to this issue I pressed into service a cheapo WiFi extender laying about doing very little, and all has been fine since.


The first thing I printed from this new setup was a nice box for the Orange Pi Zero, and I slapped a fan on the top with 5V power provided by the main board. It works a treat in keeping the board cool and calm.


I was also motivated to 3D print a side holder for the filament for a couple of reasons. Firstly, the filament wasn't flowing real well and it sometimes became "semi-stuck" with the wacky angle of attack from the top of the printer.

Secondly, I eventually would like to put the printer up on a concrete block with vibration dampers as seen in this video - and so to fit in the "medium" enclosure the spool must migrate to the side, providing the needed vertical space.

The side spool holder print went well and the result is lovely (and works a treat!). I did add a homemade spring to help align the spool with the feeder.


3. Getting a picture

I started to think about how I could get an actual picture of the print so that I could monitor the printer from the warmth and comfort of an armchair upstairs. Experts online assured me that the Orange Pi Zero would struggle, although I still like the idea of using an old laptop camera wired in for the job.

However, I did also have an ESP-32 Cam module acquired for a song which maybe could be pressed into service. The example camera webserver code provided with the ESP-32 board definitions was simple and worked well, but I could not see the ongoing printing in the low light of the enclosure, and as well it seemed silly that the camera module (and printed box) had a bright LED but that it didn't seemed to be accessible on the standard web server page.

After a quick play with a bluetooth option (it slowed down picture acquisition too much for me) along comes the genius of Hermann Stamm-Wilbrandt and his modified webserver...and we now have a "flash" button to play with in order to light up the scene and take great pics or streams of the printing action. Nice one, Hermann!

I then printed a 3D printed box to wrap the ESP32 in (with two warnings: the lid needs to be separated out from the other components - I used "MeshLab" and then it needed to be flipped in Ultimaker Cura for access to the 5V/GND pins; also make sure that you do at least a 40% infill for added strength needed for the "ball" part of the construction) and all went well. You can see mine printed below with a modified white lid indicating the flipped access point.



#include "esp_camera.h"
#include <WiFi.h> // // WARNING!!! Make sure that you have either selected ESP32 Wrover Module, // or another board which has PSRAM enabled // // Select camera model //#define CAMERA_MODEL_WROVER_KIT //#define CAMERA_MODEL_ESP_EYE //#define CAMERA_MODEL_M5STACK_PSRAM //#define CAMERA_MODEL_M5STACK_WIDE #define CAMERA_MODEL_AI_THINKER #include "camera_pins.h" const char* ssid = "*********"; const char* password = "*********"; const int pin_vsync = VSYNC_GPIO_NUM; void startCameraServer(); void setup() { Serial.begin(115200); Serial.setDebugOutput(true); Serial.println(); camera_config_t config; config.ledc_channel = LEDC_CHANNEL_0; config.ledc_timer = LEDC_TIMER_0; config.pin_d0 = Y2_GPIO_NUM; config.pin_d1 = Y3_GPIO_NUM; config.pin_d2 = Y4_GPIO_NUM; config.pin_d3 = Y5_GPIO_NUM; config.pin_d4 = Y6_GPIO_NUM; config.pin_d5 = Y7_GPIO_NUM; config.pin_d6 = Y8_GPIO_NUM; config.pin_d7 = Y9_GPIO_NUM; config.pin_xclk = XCLK_GPIO_NUM; config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; config.pin_sscb_sda = SIOD_GPIO_NUM; config.pin_sscb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; //init with high specs to pre-allocate larger buffers if(psramFound()){ config.frame_size = FRAMESIZE_UXGA; config.jpeg_quality = 10; config.fb_count = 2; } else { config.frame_size = FRAMESIZE_SVGA; config.jpeg_quality = 12; config.fb_count = 1; } #if defined(CAMERA_MODEL_ESP_EYE) pinMode(13, INPUT_PULLUP); pinMode(14, INPUT_PULLUP); #endif // camera init esp_err_t err = esp_camera_init(&config); if (err != ESP_OK) { Serial.printf("Camera init failed with error 0x%x", err); return; } sensor_t * s = esp_camera_sensor_get(); //initial sensors are flipped vertically and colors are a bit saturated if (s->id.PID == OV3660_PID) { s->set_vflip(s, 1);//flip it back s->set_brightness(s, 1);//up the blightness just a bit s->set_saturation(s, -2);//lower the saturation } //drop down frame size for higher initial frame rate s->set_framesize(s, FRAMESIZE_QVGA); #if defined(CAMERA_MODEL_M5STACK_WIDE) s->set_vflip(s, 1); s->set_hmirror(s, 1); #endif WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); startCameraServer(); Serial.print("Camera Ready! Use 'http://"); Serial.print(WiFi.localIP()); Serial.println("' to connect"); } void loop() { // put your main code here, to run repeatedly: delay(10000); }


No doubt there are many more mods for this printer to come (e.g. a filament guide) but at this point and after a couple of weeks I have to say that it's a very good printer for the price, and the super cheap additions of an Orange Pi Zero and ESP-32 CAM just make the whole printing process so much easier to set up and monitor.




2 comments:

  1. Hey, found your blog while watching a youtuber talking about one of your circuits. I saw you talking about your Ender 3. I have an original (v1??) of the ender 3 and it's been a workhorse. Some of the best mods I've used (YMMV) have been a direct drive replacement for the extruder, Octoprint (which you have), and an upgraded controller board for the printer.

    The original board was really not very good and the motors were horribly loud. Now the loudest thing is the fan on the print head. I added a plugin for TP link smart switch and now OctoPrint can turn the printer on and off for me. I had to make a USB cable sans +5v but it works great.

    I also made one of these tonight (the RGB Led progress meter) from this video: https://www.youtube.com/watch?v=lTOuqMfCg7M&t=2s&ab_channel=pileofstuff - that guy is the one that I found you from in a different video.

    Anyway, just wanted to chime in. I'll be checking out your site.

    ReplyDelete
  2. Thank you I am keen on the visual progress meter, very cool idea!

    ReplyDelete